title: Recursive binding in WPF with templates
body: <p>So I have a custom class that is designed to contain menu items and sub menu items formatted as such:</p>
  
  <pre><code>public class ApplicationMenuItem
  {
      public ImageSource Image { get; set; }
      public string Text { get; set; }
      public string Tooltip { get; set; }
      public ICollection&lt;ApplicationMenuItem&gt; Items { get; set; }
      public EventHandler Clicked {get;set;}
      public void Click(object sender, EventArgs e)
      {
          if (Clicked!=null)
              Clicked(this, e);
      }
      public ApplicationMenuItem(string Text)
      {
          this.Text = Text;
          Items = new List&lt;ApplicationMenuItem&gt;();
      }
      public ApplicationMenuItem()
      {
          Items = new List&lt;ApplicationMenuItem&gt;();
      }
  
  }
  </code></pre>
  
  <p>Before anybody asks why I don't inherit <code>Menu</code> or just create a <code>Menu</code> object and bind it, its because this class may be used on platforms and frameworks that don't necessarily use the <code>Menu</code> UI object, not to mention this class will drive nav menus, context menus, sidebars, toolbars etc....</p>
  
  <p>My question is as you can see I have a self referencing list <code>Items</code> contained within to allow sub menus; binding the first level menu elements is easy enough, but how do I recursively bind sub elements while creating a template for its elements in WPF?</p>