收录日期:2019/05/20 13:07:53 时间:2011-08-08 15:13:58 标签:wpf,winforms,menustrip

we have "layoutstyle" property in Winform to change the layoutstyle to horrizontal/vertical(all heading and Submenus), what is to be used in WPF to get the same result.

You can give your menu a new ItemsPanelTemplate like this:

<Menu>
    <Menu.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel Orientation="Vertical"/>
        </ItemsPanelTemplate>
    </Menu.ItemsPanel>
    <MenuItem Header="File"/>
    <!-- Other menu items -->
</Menu>

This will layout your menuitems vertically.