[ACCEPTED]-submenu items in WPF Menu-menuitem
Accepted answer
For submenus you can add as many MenuItem 1 nested inside.
<Menu>
<MenuItem Header="File">
<MenuItem Header="Open"/>
<MenuItem Header="Close"/>
</MenuItem>
<MenuItem Header="Edit">
<MenuItem Header="Copy"/>
<MenuItem Header="Paste"/>
</MenuItem>
<MenuItem Header="Options"/>
Just redefine the ItemsPanel
:
<Menu>
<Menu.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</Menu.ItemsPanel>
<MenuItem Header="Foo"/>
<MenuItem Header="Bar"/>
<MenuItem Header="Baz"/>
...
</Menu>
Note that this will not 4 get rid of the vertical gradient effect 3 in Vista/Win7 menus. If you want that, set 2 Menu.Background
property to whatever you want (could even 1 be Transparent
).
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.