tags:

views:

667

answers:

4

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

+1  A: 

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).

Pavel Minaev
A: 

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"/>
Jobi Joy
A: 

Thanks but I am looking for Menu items to slide right side when mouse is focused on the Menu strip(menu strip should be in Vertical style)?

A: 

Can i change the Background in menu item in WPF?

laura