title: WPF MenuItem template makes subitem background transparent
body: <p>I want to modify the <strong>TopLevelHeader</strong> to not display any borders and hover effects. To do so I've overwritten the default MenuItem style using the following MSDN example:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/ms747082%28v=vs.90%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms747082(v=vs.90).aspx</a></p>
  
  <p>My problem is that with this style the subItems are displayed with a transparent background. I've also tried to use the style form aero.normalcolor.xaml but the problem remains, the subItems have a transparent background.</p>
  
  <p>The relevant part:</p>
  
  <pre><code>&lt;Style x:Key="SimpleMenuItemBasic" TargetType="{x:Type MenuItem}"&gt;    
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="Role" Value="TopLevelHeader"&gt;
                  &lt;Setter Property="Template"&gt;
                      &lt;Setter.Value&gt;
                          &lt;ControlTemplate TargetType="{x:Type MenuItem}"&gt;
                              &lt;Border Name="Border" &gt;
                                  &lt;Grid&gt;
                                      &lt;ContentPresenter ContentSource="Header" RecognizesAccessKey="True" /&gt;
                                      &lt;Popup Name="Popup" 
                                             Placement="Bottom" 
                                             IsOpen="{TemplateBinding IsSubmenuOpen}" 
                                             AllowsTransparency="True" 
                                             Focusable="False" 
                                             PopupAnimation="Fade"&gt;
                                          &lt;Border Name="SubmenuBorder" SnapsToDevicePixels="True" 
                                                  Background="{DynamicResource WindowBackgroundBrush}"
                                                  BorderBrush="{DynamicResource SolidBorderBrush}"
                                                  BorderThickness="1"&gt;
                                              &lt;ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle"
                                                                                  KeyboardNavigation.TabNavigation="Cycle"
                                                                                  Margin="0,0,0,1"
                                                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/&gt;
                                          &lt;/Border&gt;
                                      &lt;/Popup&gt;
                                  &lt;/Grid&gt;
                              &lt;/Border&gt;
                              &lt;ControlTemplate.Triggers&gt;
                                  &lt;Trigger Property="IsSuspendingPopupAnimation" Value="true"&gt;
                                      &lt;Setter TargetName="Popup" Property="PopupAnimation" Value="None"/&gt;
                                  &lt;/Trigger&gt;
                                  &lt;Trigger Property="IsHighlighted" Value="true"&gt;
                                      &lt;Setter TargetName="Border" Property="Background" Value="{DynamicResource NormalBrush}"/&gt;
                                      &lt;Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/&gt;
                                  &lt;/Trigger&gt;
                                  &lt;Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True"&gt;
                                      &lt;Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,0,4,4"/&gt;
                                      &lt;Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,3"/&gt;
                                  &lt;/Trigger&gt;
                                  &lt;Trigger Property="IsEnabled" Value="False"&gt;
                                      &lt;Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/&gt;
                                  &lt;/Trigger&gt;
                              &lt;/ControlTemplate.Triggers&gt;
                          &lt;/ControlTemplate&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
                  &lt;Setter Property="Grid.IsSharedSizeScope" Value="true"/&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>And the usage example:</p>
  
  <pre><code>&lt;Menu&gt;
      &lt;MenuItem Header="menuItem1" Style="{StaticResource SimpleMenuItemBasic}"&gt;
          &lt;MenuItem Header="subitem1" /&gt;
          &lt;MenuItem Header="subitem2" /&gt;
      &lt;/MenuItem&gt;
  &lt;/Menu&gt;
  </code></pre>