Summary: My global "ContextMenu" style doesn't get applied to the default context menu on textboxes, and other controls.
Specifics: I've got a few TextBoxes in my application which don't have an explicit ContextMenu. So when you right click on them you see the standard context menu options of Cut, Copy, and Paste. However, that context menu doesn't end up using the global "ContextMenu" style I've set up in Generic.xaml. Is the default context menu on a TextBox not actually a ContextMenu?
If I explicitly set the ContextMenu of the Textbox, then the menu uses my global ContextMenu style. For example, this works fine:
<Style TargetType="{x:Type TextBox}">
<Setter Property="ContextMenu" Value="{StaticResource StandardContextMenu}"/>
</Style>
<ContextMenu x:Key="StandardContextMenu">
<MenuItem Header="Cut" Command="ApplicationCommands.Cut"/>
<MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
<MenuItem Header="Paste" Command="ApplicationCommands.Paste"/>
</ContextMenu>
But I really don't want to have to create this entirely redundant ContextMenu just to get WPF to apply the properly style. Plus, there are other controls besides TextBox that show ContextMenus when clicked, and those don't pick up the global ContextMenu style either.
So, what's actually getting displayed when I right-click a TextBox that doesn't have an explicit ContectMenu defined? Is that thing not a ContextMenu? Why doesn't it use the global ContextMenu style?
Edit: Looking into this further using Snoop, I found that when I explicitly add a ContextMenu, it's shown as a ContextMenu in the visual tree. But the default ContextMenu that gets displayed is shown as an EditorContextMenu in the visual tree. Next question, then, is how to style an EditorContextMenu globally.