I have styled my Menu/ContextMenu/MenuItem controls in App.xaml so that those styles apply to all my app.
defined like this (e.g. with the MenuItem):
<Style TargetType="{x:Type MenuItem}">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<!-- more setters -->
</Style>
this is working great.
now, at some point I have a RichTextBox, and I would like its ContextMenu and MenuItems to have a different style.
So I wrote:
<RichTextBox>
<RichTextBox.ContextMenu>
<ContextMenu>
<MenuItem Command="Undo" Style="{StaticResource menuItem}">Toto</MenuItem>
<MenuItem Command="Redo"/>
<Separator/>
<MenuItem Command="Cut"/>
<MenuItem Command="Copy"/>
<MenuItem Command="Paste"/>
<MenuItem Command="SelectAll"/>
</ContextMenu>
</RichTextBox.ContextMenu>
<!-- and here the RichTextBox's conent -->
</RichTextBox>
and now I'm trying to figure out where I can put my new style... Problem is: I can't figure it out: no matter where and How I add it (static ressource on the RichTextBox, or on The ContextMenu, with an explicit Key or just a targetType), I cannot get rid of my "Global" style. And the local one is just ignored.
how can I proceed?