title: C# WPF Menu Item Style let the Header disappear
body: <p>I have set a style for my <code>MenuItems</code> which looks like the following</p>
  
  <p>App.xaml</p>
  
  <pre><code>&lt;Style x:Key="MenuItemHover" TargetType="MenuItem"&gt;
          &lt;Setter Property="Width" Value="50"&gt;&lt;/Setter&gt;
          &lt;Setter Property="FontFamily" Value="Calibri"&gt;&lt;/Setter&gt;
          &lt;Setter Property="Template"&gt;
  
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="MenuItem"&gt;
  
                      &lt;Border x:Name="border"
                              Background="#282828"
                              &gt;
  
                      &lt;/Border&gt;
  
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                              &lt;Setter TargetName="border" Property="Background" Value="Gray"&gt;&lt;/Setter&gt;
  
                          &lt;/Trigger&gt;
                      &lt;/ControlTemplate.Triggers&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>MainWindow.xaml</p>
  
  <pre><code>&lt;Menu x:Name="Menu_Dropdown" Width="150" Background="#282828" Foreground="White" HorizontalAlignment="Left" Grid.Column="0" Grid.ColumnSpan="2" Height="25" VerticalAlignment="Top"&gt;
          &lt;MenuItem x:Name="MenuItem_User" Height="25" Header="Nutzer" Style="{DynamicResource MenuItemHover}"&gt;&lt;/MenuItem&gt;
          &lt;MenuItem x:Name="MenuItem_Kasse" Header="Kasse" Style="{DynamicResource MenuItemHover}"&gt;&lt;/MenuItem&gt;
          &lt;MenuItem x:Name="MenuItem_Design" Header="Design" Style="{DynamicResource MenuItemHover}"&gt;&lt;/MenuItem&gt;
      &lt;/Menu&gt;
  </code></pre>
  
  <p>When I use my style "MenuItemHover" it let the text disappear. The rest is working fine. (so the hover effect itself - it's changing the color when I move my mouse over)</p>
  
  <p>Without using the style the header is getting showed normally.</p>