MenuItem is a control which is added to Menu instances, or as a child of other MenuItems. MenuItems can be created automatically or explicitly when working with a Menu.
Code Example - Creating MenuItems
The following code shows how to create menu items. Notice that MenuItems can be added to a Menu, or as children of other MenuItems.
var menu =newMenu();Root.Children.Add(menu.Visual);var fileMenuItem =newMenuItem();fileMenuItem.Header="File";menu.Items.Add(fileMenuItem);var newItem =newMenuItem();newItem.Header="New";fileMenuItem.Items.Add(newItem);var loadRecent =newMenuItem();loadRecent.Header="Load Recent";fileMenuItem.Items.Add(loadRecent);for(int i =0; i <10; i++){var item =newMenuItem();item.Header="File "+ i;loadRecent.Items.Add(item);}var editMenuItem =newMenuItem();editMenuItem.Header="Edit";menu.Items.Add(editMenuItem);