title: Styling Multiple Menus in WPF
body: <p>I'm new to WPF and am trying to figure out how to customize menus for a Windows 7 touch screen application. I'm using the xaml below that was taken from another question on StackOverflow to style one of the menus. I now want to style another menu that will be used in a different way. How would I style another menu of the same type? </p>
  
  <p>If the answer should be simple / something I should be able to figure out, please post a link to where I can read on how to do this type of thing. I've been reviewing MSDN for a while now and while I'm reading all sorts of stuff I already know, I'm not seeing anything helpful for me here. (Sorry, just discouraged by the constant battle to find basic information I need to complete a simple task.)</p>
  
  <pre><code>&lt;Window.Resources&gt;
  
          &lt;Style TargetType="ContextMenu"&gt;
              &lt;Setter Property="SnapsToDevicePixels" Value="True"/&gt;
              &lt;Setter Property="OverridesDefaultStyle" Value="True"/&gt;
              &lt;Setter Property="Grid.IsSharedSizeScope" Value="true"/&gt;
              &lt;Setter Property="HasDropShadow" Value="True"/&gt;
              &lt;Setter Property="Template"&gt;
                  &lt;Setter.Value&gt;
                      &lt;ControlTemplate TargetType="ContextMenu"&gt;
                          &lt;Border 
                              Name="Border"
                              BorderThickness="1"
                              BorderBrush="{DynamicResource userContextMenuBorder}"
                              Background="{DynamicResource userContextMenuBackground}"
                              MinWidth="182"
                              MinHeight="60"
                              &gt;
  
                              &lt;StackPanel IsItemsHost="True"
                                  KeyboardNavigation.DirectionalNavigation="Cycle"
                                  &gt;
                              &lt;/StackPanel&gt;
                          &lt;/Border&gt;
                          &lt;ControlTemplate.Triggers&gt;
                              &lt;Trigger Property="HasDropShadow" Value="true"&gt;
                                  &lt;Setter TargetName="Border" Property="Padding" Value="0,3,0,3"/&gt;
                              &lt;/Trigger&gt;
                          &lt;/ControlTemplate.Triggers&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
  
          &lt;!-- SimpleStyles: MenuItem --&gt;
  
          &lt;Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}"&gt;
              &lt;Setter Property="Height" Value="1"/&gt;
              &lt;Setter Property="Margin" Value="0,4,0,4"/&gt;
              &lt;Setter Property="Template"&gt;
                  &lt;Setter.Value&gt;
                      &lt;ControlTemplate TargetType="{x:Type Separator}"&gt;
                          &lt;Border BorderBrush="{DynamicResource userContextMenuSeparatorBorder}" BorderThickness="1"/&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
  
          &lt;!-- TopLevelHeader --&gt;
  
          &lt;ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}"&gt;
              &lt;Border Name="Border" &gt;
                  &lt;Grid&gt;
                      &lt;ContentPresenter 
                              Margin="6,3,6,3" 
                              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 userCMSubmenuBackground}"
                            BorderBrush="{DynamicResource userCMSubmenuBorder}"
                            BorderThickness="1" &gt;
                              &lt;StackPanel  
                                  IsItemsHost="True" 
                                  KeyboardNavigation.DirectionalNavigation="Cycle" /&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 userContextMenuHighlightedBackground}"/&gt;
                      &lt;Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource userContextMenuHighlightedBorder}"/&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 userContextMenuForeground}"/&gt;
                  &lt;/Trigger&gt;
              &lt;/ControlTemplate.Triggers&gt;
          &lt;/ControlTemplate&gt;
  
          &lt;!-- SubmenuHeader --&gt;
  
          &lt;ControlTemplate 
    x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" 
    TargetType="{x:Type MenuItem}"&gt;
              &lt;Border Name="Border" Background="{DynamicResource userCMSubmenuHeaderBackground}"&gt;
                  &lt;Grid&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="Auto" SharedSizeGroup="Icon"/&gt;
                          &lt;ColumnDefinition Width="*" /&gt;
                          &lt;ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/&gt;
                          &lt;ColumnDefinition Width="13"/&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;ContentPresenter 
          Name="Icon"
          Margin="6,0,6,0"
          VerticalAlignment="Center"
          ContentSource="Icon"/&gt;
                      &lt;ContentPresenter 
          Name="HeaderHost"
          Grid.Column="1"
          ContentSource="Header"
          RecognizesAccessKey="True"/&gt;
                      &lt;TextBlock x:Name="InputGestureText"
          Grid.Column="2"
          Text="{TemplateBinding InputGestureText}"
          Margin="5,2,2,2"
          DockPanel.Dock="Right"/&gt;
                      &lt;Path 
          Grid.Column="3"
          HorizontalAlignment="Center"
          VerticalAlignment="Center"
          Data="M 0 0 L 0 7 L 4 3.5 Z" 
          Fill="#404040" /&gt;
                      &lt;Popup 
          Name="Popup"
          Placement="Right"
          HorizontalOffset="-4" 
          IsOpen="{TemplateBinding IsSubmenuOpen}"
          AllowsTransparency="True" 
          Focusable="False"
          PopupAnimation="Fade"&gt;
                          &lt;Border 
            Name="SubmenuBorder"
            SnapsToDevicePixels="True"
            Background="#FFFFFF"
            BorderBrush="#888888"
            BorderThickness="1" &gt;
                              &lt;StackPanel  
              IsItemsHost="True" 
              KeyboardNavigation.DirectionalNavigation="Cycle" /&gt;
                          &lt;/Border&gt;
                      &lt;/Popup&gt;
                  &lt;/Grid&gt;
              &lt;/Border&gt;
              &lt;ControlTemplate.Triggers&gt;
                  &lt;Trigger Property="Icon" Value="{x:Null}"&gt;
                      &lt;Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsHighlighted" Value="true"&gt;
                      &lt;Setter TargetName="Border" Property="Background"&gt;
                          &lt;Setter.Value&gt;
                              &lt;LinearGradientBrush&gt;
                                  &lt;GradientStop Color="#EEEEEE" Offset="0"/&gt;
                                  &lt;GradientStop Color="#FFFFFF" Offset="1"/&gt;
                              &lt;/LinearGradientBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True"&gt;
                      &lt;Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="4"/&gt;
                      &lt;Setter TargetName="SubmenuBorder" Property="Padding" Value="0,3,0,3"/&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsEnabled" Value="false"&gt;
                      &lt;Setter Property="Foreground" Value="#888888"/&gt;
                  &lt;/Trigger&gt;
              &lt;/ControlTemplate.Triggers&gt;
          &lt;/ControlTemplate&gt;
  
          &lt;!-- MenuItem Style --&gt;
  
          &lt;Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}"&gt;
              &lt;Setter Property="OverridesDefaultStyle" Value="True"/&gt;
              &lt;Style.Triggers&gt;
                  &lt;Trigger Property="Role" Value="TopLevelHeader"&gt;
                      &lt;Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelHeaderTemplateKey}}"/&gt;
                      &lt;Setter Property="Grid.IsSharedSizeScope" Value="true"/&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="Role" Value="TopLevelItem"&gt;
                      &lt;Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelItemTemplateKey}}"/&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="Role" Value="SubmenuHeader"&gt;
                      &lt;Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuHeaderTemplateKey}}"/&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="Role" Value="SubmenuItem"&gt;
                      &lt;Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuItemTemplateKey}}"/&gt;
                  &lt;/Trigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Window.Resources&gt;
  </code></pre>