I have defined a menu template which, in theory, should use the backgroundcolor of the "AppBackground" SoliColorBrush, defined in a separate file.
When in "debug mode", I use the following code to change that variable: this.Resources["AppBackground"] = new SolidColorBrush(Colors.DarkGreen);
This has the intended effect on the application background, however, it doesn't seem to have an effect on the custom menu design I have. I have tried to use both StaticResource and DynamicResource, without any luck. Is this a known issue, and is there a trick here?
Defined in ResourceDirectory:
<SolidColorBrush x:Key="AppBackground" Color="#003466"/>
Defined in a file:
<Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Border x:Name="Border" BorderThickness="1">
<Grid Background="{Binding Source={StaticResource AppBackground}}">