English 中文(简体)
背 景
原标题:Context Menu background coloring

我在想在西马洛创造的环境时遇到麻烦。 它应当简明扼要,只是一份带有偶尔分离器的菜单清单。

我早就能够正确安排,所有物品都处于正确的位置,现在我正在忙着打碎和ty。 我们的主题是,在申请一级揭露一些名声的rush,如我对背景、菜单和分离器的控制,我把这些名字当作动态资源。 迄今为止,所有这一切都不符合标准。

I m 看到的问题是,对于我的分离者来说,我有一层楼面左侧的空地,没有像其他菜园那样显示同一背景,而后者非常视而不见。 你可以看到一个例子,并描绘它如何在我们更黑暗的主题上恶化!

Imgur

And in our dark style:

Imgur

Here is the style I m using for the contextmenu and the separator:

<Style TargetType="{x:Type ContextMenu}">
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="{DynamicResource HighlightBrush}"/>
        </Trigger>
        <DataTrigger Binding="{Binding ContextMenu.IsOpen,RelativeSource={RelativeSource Mode=Self}}" Value="True">
            <Setter Property="Background" Value="{DynamicResource HighlightBrush}"/>
        </DataTrigger>
    </Style.Triggers>
    <Setter Property="Background" Value="{DynamicResource BackgroundLight}" />
    <Setter Property="Foreground" Value="{DynamicResource ForegroundText}" />
    <Setter Property="BorderThickness" Value="1" />
</Style>

<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Separator}">
                <Grid Margin="0,6,0,4" SnapsToDevicePixels="true">
                    <Rectangle Margin="30,0,1,1" Height="1" Fill="{DynamicResource BackgroundLight}"/>
                    <Rectangle Margin="30,1,1,0" Height="1" Fill="{DynamicResource ContextMenuSeparator}"/>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

我不知道这一花钱来自何处,而我只看到一个带有白色Canvas的“内容”,我不知道如何去除。 前面有人看到这一点吗?

问题回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签