title: C# WPF MenuItem custom template
body: <p>In Main.xaml I have these two menu items:</p>
  
  <ul>
  <li>The first with the header = <strong>Disconnect from current</strong></li>
  <li>The second with the header = <strong>Quit</strong></li>
  <li>...</li>
  <li>More menu items with different header texts...</li>
  </ul>
  
  <p>In order to edit some colors of the first item I created a custom template in App.xaml:</p>
  
  <pre><code>&lt;!--Template for Menu Items--&gt;
      &lt;Style x:Key="MenuItemBaseStyle" TargetType="MenuItem"&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="IsMouseOver" Value="true"&gt;
                  &lt;Setter Property="Background" Value="#0a99f3" /&gt;
                  &lt;Setter Property="Foreground" Value="White"/&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type MenuItem}"&gt;
                      &lt;Grid Background="{TemplateBinding Background}"&gt;
                          &lt;MenuItem Header="DISCONNECT FROM CURRENT" /&gt;
                      &lt;/Grid&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>And in Main.xaml:</p>
  
  <pre><code>&lt;MenuItem Header="CONNECTION"&gt;
      &lt;MenuItem Style="{StaticResource MenuItemBaseStyle}" Header="DISCONNECT FROM CURRENT" /&gt;
      &lt;MenuItem Header="QUIT"/&gt;
  &lt;/MenuItem&gt;
  </code></pre>
  
  <p>Now I want to do the same for the second menu item. The problem is with the different header. If I delete the header from the template, it won't show any header even if the header text is still present in Main.xaml</p>
  
  <p>How can I use this template for many menu items where the only thing that changes is the header text?</p>