我有一个菜单,要求我设计样式,使项目具有圆角......基本上使它们看起来像按钮。
我想更改子菜单后面的黑色背景,使其透明。白色也可以啊
这个黑色不是子项目按钮的边框,因为我可以将其设置为黄色,并且我看到轻微的黄色边框,但仍然看到黑色背景。
作为测试,我将所有黑色实例更改为紫色,但仍然得到黑色背景。所以我无法判断它是从哪里来的。
谢谢。
I have a menu that I've been asked to style so that the items have rounded corners... basically so that they look like buttons.
I want to change the black background behind the sub-menu so that it's transparent. White would be OK too.
This black isn't the border of the child item's buttons as I can set that to yellow and I see a slight yellow border but still see the black background.
I changed all the instances of black to purple as a test and still got this black background. So I can't tell where it's coming from.
Thanks.
发布评论
评论(2)
您需要重新设计菜单。 此处是默认情况下如何完成此操作的示例。查看 中的 ,将
Popup
,您需要将其替换为您的实现。也许您只需要删除ScrollViewer
直接作为Popup
的子级。You'll need to restyle the menu. Here is the example of how it's done by default. Look at the
Popup
in<ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" ...
, you'll need to replace it with your implementation. Perhaps you just need to remove<Border Name="SubmenuBorder"...
, putting theScrollViewer
directly as a child ofPopup
.成功!为了使弹出窗口的边框背景透明,您需要在弹出窗口元素上设置AllowsTransparency =“True”。
Success! In order for the Popup's Border's background to be transparent you need to set AllowsTransparency="True" on the Popup element.