AvalonDock文档菜单下拉主题颜色 [英] AvalonDock Document Menu DropDown Theming Colors

查看:193
本文介绍了AvalonDock文档菜单下拉主题颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个利用Windows Accent Color的AvalonDock主题: https://github.com/Dirkster99/AvalonDock

I am trying to develop an AvalonDock theme that makes use of the Windows Accent Color: https://github.com/Dirkster99/AvalonDock

请参阅/source/Components/Xceed.Wpf.AvalonDock.Themes.VS2013文件夹作为主题

see /source/Components/Xceed.Wpf.AvalonDock.Themes.VS2013 folder for theme

问题在于,我似乎找不到在下面第二个屏幕快照所示的文档下拉菜单中定义突出显示颜色的解决方案.主题以某种方式适用于工具窗口的下拉菜单,如下图所示,但我似乎无法以相同的主题来处理文档菜单的下拉菜单.

The problem is that I cannot seem to find a solution for defining the highlighting colors in the document drop down menu shown in the second screenshot below. Somehow the theming works for the tool window drop down as you can see below but I cannot seem to get the same theming to work for document menu drop down.

到目前为止,我已经确定文档下拉菜单的主题是:

So far, I have established that the document drop down menu is themed here:

/source/Components/Xceed.Wpf.AvalonDock.Themes.VS2013/Themes/Generic.xaml (在第132行找到ContextMenuEx标签.)

/source/Components/Xceed.Wpf.AvalonDock.Themes.VS2013/Themes/Generic.xaml (Look for ContextMenuEx tag at about line 132).

我一直在尝试各种方法,但是无法使此突出显示起作用.

I've been trying all kinds of things but can't get this highlighting to work.

我是否必须为MenuItemEx和/或ContextMenuEx定义一个完整的主题才能使它起作用,或者有更简单的解决方案吗?

Do I have to define a complete theme for MenuItemEx and/or ContextMenuEx to get this to work or is there a more simple solution to this?

<avalonDockControls:DropDownButton x:Name="MenuDropDownButton"
                               Grid.Column="1"
                               VerticalAlignment="Center"
                               Focusable="False"
                               Style="{StaticResource AvalonDockThemeVs2013ToolButtonStyle}">
<avalonDockControls:DropDownButton.DropDownContextMenu>
    <avalonDockControls:ContextMenuEx ItemsSource="{Binding Model.ChildrenSorted, RelativeSource={RelativeSource TemplatedParent}}">
        <avalonDockControls:ContextMenuEx.ItemContainerStyle>
            <Style TargetType="{x:Type avalonDockControls:MenuItemEx}" BasedOn="{StaticResource {x:Type MenuItem}}">
                <Setter Property="HeaderTemplate" Value="{Binding Path=Root.Manager.DocumentPaneMenuItemHeaderTemplate}" />
                <Setter Property="HeaderTemplateSelector" Value="{Binding Path=Root.Manager.DocumentPaneMenuItemHeaderTemplateSelector}" />
                <Setter Property="IconTemplate" Value="{Binding Path=Root.Manager.IconContentTemplate}" />
                <Setter Property="IconTemplateSelector" Value="{Binding Path=Root.Manager.IconContentTemplateSelector}" />
                <Setter Property="Command" Value="{Binding Path=., Converter={StaticResource ActivateCommandLayoutItemFromLayoutModelConverter}}" />
            </Style>
        </avalonDockControls:ContextMenuEx.ItemContainerStyle>
    </avalonDockControls:ContextMenuEx>
</avalonDockControls:DropDownButton.DropDownContextMenu>
<Rectangle x:Name="MenuDropDownButtonImage"
           Fill="{DynamicResource {x:Static reskeys:ResourceKeys.DocumentWellOverflowButtonDefaultGlyph}}"
           Width="12" Height="12">
    <Rectangle.OpacityMask>
        <ImageBrush ImageSource="../Images/PinDocMenu.png" />
    </Rectangle.OpacityMask>
</Rectangle>
</avalonDockControls:DropDownButton>

工具窗口上下文菜单下拉菜单

Tool Window Context Menu Drop Down

推荐答案

我能够通过如下所示重新模板化ContextMenu项来解决此问题: 在MouseOver上更改MenuItem的背景颜色

I was able to resolve this issue by retemplating the ContextMenu item as suggested here: Change Background color of MenuItem on MouseOver

这篇关于AvalonDock文档菜单下拉主题颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆