MenuItem
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
The following code shows how to create menu items. Notice that MenuItems can be added to a Menu, or as children of other MenuItems.
IsSelected controls whether the MenuItem displays its Selected state. If this value is true, the MenuItem displays its contained Items.
Typically this property is set to true by clicking on a MenuItem, or by hovering over a MenuItem after its parent is selected, but it can also be explicitly set to true.
The following code shows how to explicitly set IsSelected to true based on keyboard input:
By default MenuItems in a Menu are not selected unless the user clicks on the MenuItem. Once an item is selected, the user can hover over any menu item (either in the Menu itself, or a child MenuItem) to automatically expand the MenuItem.