Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,
i have dynamic menu control in wpf from each menu item should having usercontrol name

from their i need to navigate i have tried it not workin g converting string control can u guide or send snippets


public void MenuBuilder()
{
MenuItem memu=new MenuItem();
memu.Header = "suhe";
memu.Name = "UserControl1";
memu.Click += new RoutedEventHandler(memu_Click);
memus.Items.Add(memu);
}

void memu_Click(object sender, RoutedEventArgs e)
{
MenuItem mnu = (MenuItem)e.OriginalSource;


UserControl userControl = new UserControl();

userControl = (UserControl)Assembly.GetEntryAssembly().CreateInstance(mnu.Name);

grdmain.Children.Add(userControl);

}
Posted
Updated 12-Feb-14 20:10pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900