复选标记显示为黑盒子的菜单 [英] Check Mark Showing as a Black Box in Menu
问题描述
好吧,我有一个已经完全难倒我的问题。我有需要是可检查的,但是当我检查项目呈现它只是一个黑盒子(我试着上传问题的照片,但StackOverflow上不会让我)工具栏里面的菜单。当你将鼠标放在对勾正确呈现。我不明白,我试图消除可能会影响它,但似乎没有影响到它的任何样式。
谁能帮
下面是XAML菜单项:
<工具栏ToolBarTray.IsLocked =真保证金=0填充=0ToolBar.OverflowMode =从不>
<按钮命令=玉米:FormatCommands.LogInCommand>
< Viewbox控件WIDTH =15>
<图像来源=.. \Resources\Login.png/>
< / Viewbox控件>
< /按钮>
<按钮命令=玉米:FormatCommands.LogOutCommand>
< Viewbox控件WIDTH =15>
<图像来源=.. \Resources\Logout.png/>
< / Viewbox控件>
< /按钮>
<按钮命令=玉米:FormatCommands.GetTodaysRacesCommand>
< Viewbox控件WIDTH =15>
<图像来源=.. \Resources\list.png/>
< / Viewbox控件>
< /按钮>
<菜单>
<菜单项标题=市场>
<菜单项IsCheckable =真标题=英国/>
<菜单项IsCheckable =真头=爱尔兰/>
< /菜单项>
< /菜单>
< /工具栏>
的工具栏
元素定义了一些样式的几个控制和菜单
就是其中之一。你可以找到在 ToolBar.MenuStyleKey
静态属性定义的风格
键。这种风格是设置背景
到#FF212121
为包含复选标记的面板。
不幸的是,我不认为有改变只为复选标记的面板背景的话,你就必须覆盖难看的菜单项$ C 。$ C>风格
注意:您的情况得到应用该样式遵循这个步骤进行:
- 在一个新的上述XAML复制与解决方案。
- 选择
菜单
在设计窗口。 - 右键点击
菜单
/编辑模板/编辑复制/输入。
Ok I have a problem that has completely stumped me. I have a menu inside a toolbar that needs to be checkable but when I check the items it renders as just a black box (I tried to upload a photo of the issue but StackOverflow wouldn't let me). When you mouse over the check mark renders correctly. I don't understand it I have tried removing any styles that might be affecting it but nothing seems to affect it.
Can anyone help?
Here is the XAML for the menu item:
<ToolBar ToolBarTray.IsLocked="True" Margin="0" Padding="0" ToolBar.OverflowMode="Never">
<Button Command="com:FormatCommands.LogInCommand">
<Viewbox Width="15">
<Image Source="..\Resources\Login.png"/>
</Viewbox>
</Button>
<Button Command="com:FormatCommands.LogOutCommand">
<Viewbox Width="15">
<Image Source="..\Resources\Logout.png"/>
</Viewbox>
</Button>
<Button Command="com:FormatCommands.GetTodaysRacesCommand">
<Viewbox Width="15">
<Image Source="..\Resources\list.png"/>
</Viewbox>
</Button>
<Menu>
<MenuItem Header="Markets">
<MenuItem IsCheckable="True" Header="British"/>
<MenuItem IsCheckable="True" Header="Irish" />
</MenuItem>
</Menu>
</ToolBar>
The ToolBar
element defines some styles for a few controls and the Menu
is one of them. You can find the Style
key defined in the ToolBar.MenuStyleKey
static property. That style is setting the Background
to #FF212121
for the Panel which contains the check mark.
Unfortunately i don't believe that there is a way to change only the background for the check mark's panel, you will have to override that ugly looking MenuItem
style.
Note: to get the style applied in your case follow this steps:
- Copy the above XAML in a new VS solution.
- Select the
Menu
in the designer window. - Right click on the
Menu
/ Edit Template / Edit a copy / Enter.
这篇关于复选标记显示为黑盒子的菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!