In my application, I have a bunch of ContextMenus, and I want them all to have the same look, which is quite basic, but it uses the resources to set HighlightBrushKey and ControlBrushKey, which are SystemColors. It looks like this:
<ContextMenu Padding="0" Background="Transparent"> <ContextMenu.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> </ContextMenu.Resources> <MenuItem Header="Delete"/> <MenuItem Header="Modify"/> </ContextMenu>
Nothing too fancy here, but I can't find a way to put it in a style, what I would like to do is something along the lines of:
<Style TargetType="ContextMenu"> <Setter Property="Padding" Value="0" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="Resources"> <Setter.Value> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" /> </Setter.Value> </Setter> </Style>
How do you put resources in a style? (if it is at all possible...)
Thanks!