设置MenuItem背景颜色(正确的方法)
每当我尝试将背景颜色更改为菜单时,将以下代码添加到 app.xml 中
<Style TargetType="MenuItem">
<Setter Property="Background" Value="#FF9B9B9B" />
</Style>
,菜单周围就会出现浅灰色阴影,该颜色不是由背景属性设置的:
我知道周围有类似的问题,但我找到的答案对我没有帮助。
Whenever I try to change the background color to a menu adding the following code to the app.xml
<Style TargetType="MenuItem">
<Setter Property="Background" Value="#FF9B9B9B" />
</Style>
I get this lighter shade of gray around the menu, which color isn't set by the background property:
I know there are similar questions around, but the answers I've found haven't helped me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此类内容被编码到菜单项的各种 ControlTemplate 中。您可能必须创建自己的。 (您可以复制默认值并根据您的喜好进行编辑)
That sort of thing is coded into the various ControlTemplates for MenuItems. You will probably have to create your own. (You could copy the defaults and edit them to your liking though)