title: How to implement a dynamically nested sidebar menu in WPF?
body: <p>I want to implement a sidebar as a UserControl in WPF.I want to load the content of the sidebar dynamically from the database. I can add any menu i can remove any, i can change the level of nesting from database. is there a way to do that with XAML and C# in WPF.</p>
  <p>My class for the menu looks something like this</p>
  <pre><code>public class Menus
    {
      public string MenuName {get;set;}
      public string MenuURL {get;set;}
      public List&lt;Menus&gt; Children {get;set;}
  
      public Menus()
        {
          Children = new List&lt;Menus&gt;();
        }
    }
  </code></pre>
  <p>I have tried various combinations with  and  but no luck.</p>
  <p>the output should look something like this.</p>
  <ul>
  <li><p>Main Menu 1</p>
  <ul>
  <li>Sub Menu 1.1</li>
  <li>Sub Menu 1.2
  <ul>
  <li>Sub Menu 1.2.1</li>
  </ul>
  </li>
  </ul>
  </li>
  <li><p>Main Menu 2</p>
  <ul>
  <li>Sub Menu 2.1
  <ul>
  <li>Sub Menu 2.2</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>thus i would be able to add any number of nested behavior from the database. I am fairly new to WPF so i don't know many ways to this. if any straight forward way is there to accomplish this then that would help</p>