Hi Sir,
Please tell me how to create XamWebMenu in codebehind (c#). Please send me the related links or code to this. I am confusing that i create xamwebmenu in expression blend and binded its styles to other menuitem controls. but how to do that in code behind? please let me know if any one know how to create menu on code behind . waiting for your reply.
have a great day.
Hi,
You can do this with code snippet below
public ContactPage(){ InitializeComponent(); Loaded += ContactPage_Loaded;}
void ContactPage_Loaded(object sender, RoutedEventArgs e){ XamWebMenu menu = new XamWebMenu(); XamWebMenuItem item1 = new XamWebMenuItem {Header = "item1"}; XamWebMenuItem item2 = new XamWebMenuItem {Header = "item2"}; XamWebMenuItem item3 = new XamWebMenuItem {Header = "item3"}; XamWebMenuItem item1_3 = new XamWebMenuItem {Header = "item1_3"}; item1.Items.Add(item1_3); menu.Items.Add(item1); menu.Items.Add(item2); menu.Items.Add(item3); this.RootLayout.Children.Add(menu);}
Where this.RootLayout is the panel where you want to show the menu.
Todor