WPF与WINFORM控件的比较

WPF与WINFORM控件的比较,wpf,winforms,menustrip,Wpf,Winforms,Menustrip,Winform中有“layoutstyle”属性,可以将layoutstyle更改为水平/垂直(所有标题和子菜单),WPF中使用的内容可以获得相同的结果。您可以为菜单提供一个新的ItemsPanelTemplate,如下所示: <Menu> <Menu.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Vertical

Winform中有“layoutstyle”属性,可以将layoutstyle更改为水平/垂直(所有标题和子菜单),WPF中使用的内容可以获得相同的结果。

您可以为菜单提供一个新的ItemsPanelTemplate,如下所示:

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

这将垂直布局菜单项