title: WPF C# - Change the brush of a menu's background
body: <p>Does anyone know how to change the brush for a menu's background? This sounds simple, but I don't see any obvious way to do this. You'd think that the Background property would change it, but it doesn't.</p>
  
  <p>Here's what my menu looks like (notice the default white background):</p>
  
  <p><strong>Example Code:</strong></p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Window1" Height="300" Width="300"&gt;
  
  &lt;Window.Resources&gt;
      &lt;SolidColorBrush x:Key="menuItemBrush"
                       Color="#FF505050" /&gt;
  &lt;/Window.Resources&gt;
  
  &lt;Grid x:Name="mainGrid"
        Background="#FF252525"&gt;
  
      &lt;Menu x:Name="mainMenu"
            Background="{DynamicResource menuItemBrush}"
            Grid.ColumnSpan="2"
            VerticalAlignment="Top"&gt;
  
          &lt;MenuItem x:Name="fileMenu"
                    Background="{DynamicResource menuItemBrush}"
                    Foreground="White"
                    Header="File"&gt;
  
              &lt;MenuItem x:Name="fileOpenMenuItem"
                        Background="{DynamicResource menuItemBrush}"
                        Foreground="White"
                        Header="Open..." /&gt;
  
              &lt;MenuItem x:Name="fileSaveMenuItem"
                        Background="{DynamicResource menuItemBrush}"
                        Foreground="White"
                        Header="Save" /&gt;
  
              &lt;MenuItem x:Name="fileSaveAsMenuItem"
                        Background="{DynamicResource menuItemBrush}"
                        Foreground="White"
                        Header="Save As..." /&gt;
  
              &lt;Separator Style="{DynamicResource menuItemSeperator}" /&gt;
  
              &lt;MenuItem x:Name="fileExitMenuItem"
                        Background="{DynamicResource menuItemBrush}"
                        Foreground="White"
                        Header="Exit" /&gt;
          &lt;/MenuItem&gt;
      &lt;/Menu&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>