Reputation: 41138
All of the MenuItems do not inherit the color. Is there a way in WPF for me to set the color automatically from the main parent colors? Thanks.
I've just discovered that the Foreground property goes through all children. Background doesn't though. :(
Upvotes: 0
Views: 219
Reputation: 33379
This is happening because of the default style/template of a ContextMenu. You need to change the template of the MenuItem
s in your Menu
to achieve the results you desire. You can do this by defining a Style with Key="{x:Type MenuItem}"
in the Menu.Resources
:
<Menu>
<Menu.Resources>
<Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
<Style Property="Template">
<Style.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<!-- your template parts here using -->
</ControlTemplate>
</Style.Value>
</Style>
</Style>
</Menu.Resources>
</Menu>
Upvotes: 1