Menu Class
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Content Model: Menu is an ItemsControl. For more information on the content model for Menu, see ItemsControl Content Model.
The Menu control presents a list of items that specify commands or options for an application. Typically, clicking an item on a menu opens a submenu or causes an application to carry out a command.
An item in a menu can be anything that can be added to an ItemCollection. The MenuItem is the most common type of item in a Menu. A MenuItem can contain child items. The child items will appear in a submenu when the user chooses a parent MenuItem.
This example shows how to create Menu controls. The example illustrates Menu controls with submenus and MenuItem elements with ToolTip controls. The example also shows how to use the IsCheckable property to make MenuItem controls that can be checked.
<Menu Width="30" Margin="10, 10, 5, 5" HorizontalAlignment="Left" Background="White"> <MenuItem Header="_File"> <MenuItem Header="_New" IsCheckable="true"/> <MenuItem Header="_Open" IsCheckable="true"/> <MenuItem Header="_Close" IsCheckable="true"/> <Separator/> <MenuItem Header="Menu with Submenu"> <MenuItem Header="_submenuitem1" IsCheckable="true"/> <MenuItem Header="_submenuitem2" IsCheckable="true"> <MenuItem Header="_submenuitem2.1" IsCheckable="true"/> </MenuItem> </MenuItem> <Separator/> <MenuItem Header="_Menu item with ToolTip"> <MenuItem.ToolTip> <ToolTip> ToolTip Information. </ToolTip> </MenuItem.ToolTip> </MenuItem> </MenuItem> </Menu>
For the complete sample, see Menu Sample.
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
System.Windows.Controls.ItemsControl
System.Windows.Controls.Primitives.MenuBase
System.Windows.Controls.Menu
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.