how to make SUBMENU ites visible vertical as a left navigation in CODEGURU.COM
In windows we use layoutstyle property to make all main and child items to be viewed vertical and DOCK the menustrip to left.
How to acheive this in WPF
how to make SUBMENU ites visible vertical as a left navigation in CODEGURU.COM
In windows we use layoutstyle property to make all main and child items to be viewed vertical and DOCK the menustrip to left.
How to acheive this in WPF
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 get rid of the vertical gradient effect in Vista/Win7 menus. If you want that, set Menu.Background
property to whatever you want (could even be Transparent
).
For submenus you can add as many MenuItem 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"/>