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.
My class for the menu looks something like this
public class Menus
{
public string MenuName {get;set;}
public string MenuURL {get;set;}
public List<Menus> Children {get;set;}
public Menus()
{
Children = new List<Menus>();
}
}
I have tried various combinations with and but no luck.
the output should look something like this.
Main Menu 1
- Sub Menu 1.1
- Sub Menu 1.2
- Sub Menu 1.2.1
Main Menu 2
- Sub Menu 2.1
- Sub Menu 2.2
- Sub Menu 2.1
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