wpf menuitem child item. How to set the color behind the drop-down
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 i开发者_开发问答sn'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.
Success! In order for the Popup's Border's background to be transparent you need to set AllowsTransparency="True" on the Popup element.
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 the ScrollViewer
directly as a child of Popup
.
精彩评论