如何设置visual studio导航菜单样式?

How to set visual studio navigation menu style?

有人知道如何设置菜单导航样式吗?特别是我想创建相同样式的 visual studio 导航菜单。在演示项目中有一个可用但我不明白样式是如何设置的。这是款式:

更新我的 APP.xaml

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TreeView.xaml" />

之前: 鼠标重叠后:

VS菜单样式被Styles.xaml资源字典使用,直接放在window的资源中,或者如果你想在hole app中,在[=14] =].

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

编辑(完整的应用资源)

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />

            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

编辑(仅菜单样式)

hole 应用程序无法仅使用菜单样式,您必须在创建菜单的位置添加资源。

<Grid>
    <Grid.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Menu.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="MenuItem"
                    BasedOn="{StaticResource StandardMenuItem}" />
            <Style TargetType="Menu"
                    BasedOn="{StaticResource StandardMenu}" />
        </ResourceDictionary>
    </Grid.Resources>
    <Menu>
        <MenuItem Header="Main">
            <MenuItem Header="Menu 1"></MenuItem>
            <MenuItem Header="Menu 2"></MenuItem>
        </MenuItem>
    </Menu>
</Grid>

希望对您有所帮助。