title: MenuItem style through ControlTemplate in ResourceDictionary not applying correctly
body: <p>I have a Button whose XAML is like this</p>
  
  <pre><code>&lt;Button x:Name="Button2" Style="{StaticResource User_Hyperlink_Button}" Tag="123456789.XAML" Width="86" Height="30" Margin="26,327,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Content="Button2" /&gt;
  </code></pre>
  
  <p>The style for the the Button is defined in the ResourceDictionary like this</p>
  
  <pre><code>&lt;Style x:Key="User_Hyperlink_Button" TargetType="{x:Type Button}"&gt;              
    &lt;Setter Property="Control.Template"&gt;
      &lt;Setter.Value&gt;
        &lt;ControlTemplate TargetType="{x:Type Button}"&gt;        
          &lt;Button Style="{DynamicResource App_button}" &gt;
            &lt;Hyperlink Style="{DynamicResource Button_LinkForeground}" NavigateUri="{Binding Path=Tag, RelativeSource={RelativeSource Mode=TemplatedParent, AncestorLevel=0}}"&gt;
              &lt;InlineUIContainer&gt;
                &lt;TextBlock Text="{Binding Path=Content, RelativeSource={RelativeSource Mode=TemplatedParent, AncestorLevel=0}}" /&gt;
              &lt;/InlineUIContainer&gt;
            &lt;/Hyperlink&gt;
          &lt;/Button&gt;
        &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
    &lt;/Setter&gt;     
  &lt;/Style&gt;
  </code></pre>
  
  <p>In this everything is working fine, but when I do the same for MenuItem the text for the MenuItem dissappears.</p>
  
  <p>The xaml for MenuItem is like this</p>
  
  <pre><code>&lt;MenuItem x:Name="MenuItem1" Style="{StaticResource User_Hyperlink_MenuItem}" Tag="123456789.XAML" Header="MenuItem1" /&gt;
  </code></pre>
  
  <p>The style is like this</p>
  
  <pre><code>&lt;Style x:Key="User_Hyperlink_MenuItem" TargetType="{x:Type MenuItem}"&gt;              
    &lt;Setter Property="Control.Template"&gt;
      &lt;Setter.Value&gt;
        &lt;ControlTemplate TargetType="{x:Type MenuItem}"&gt;        
          &lt;MenuItem Style="{DynamicResource App_MenuItem}"  &gt;
            &lt;Hyperlink Style="{DynamicResource Menu_LinkForeground}" NavigateUri="{Binding Path=Tag, RelativeSource={RelativeSource Mode=TemplatedParent, AncestorLevel=0}}"&gt;
              &lt;InlineUIContainer&gt;
                &lt;TextBlock Text="{Binding Path=Header, RelativeSource={RelativeSource Mode=TemplatedParent, AncestorLevel=0}}" /&gt;
              &lt;/InlineUIContainer&gt;
            &lt;/Hyperlink&gt;
          &lt;/MenuItem&gt;
        &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
    &lt;/Setter&gt;     
  &lt;/Style&gt;
  </code></pre>
  
  <p>I have also changed the  style like this </p>
  
  <pre><code>...
  &lt;TextBlock Text="{Binding Path=Content, RelativeSource={RelativeSource Mode=TemplatedParent, AncestorLevel=0}}" /&gt;
  ...
  </code></pre>
  
  <p>but it is not working.
  I need to fix this by modifying the style only and cannot change the xaml for MenuItem due to some limitation.</p>
  
  <p>Update 1</p>
  
  <p>I need to make MenuItem text appear on it. The text is there in the TextBlock but its value is coming from the Content Property of MenuItem. MenuItem does not have a Content property instead it has Items Collection that is why the text is not showing. Whereas in the case of Button everything is working the link, text all.</p>
  
  <p>I am working on loose XAML so I have to use Hyperlink for linking. No need to worry about recursion or inheritance as its not an issue. The problem is only that there is no Content property for MenuItem so need to solve this by getting the Item[0].</p>
  
  <p>Update 2</p>
  
  <p>I am also providing the other Resources for reference </p>
  
  <pre><code>&lt;Style x:Key="App_MenuItem" TargetType="{x:Type MenuItem}"&gt;
   &lt;Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/&gt;
   &lt;Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/&gt;
   &lt;Setter Property="Background" Value="#FF015DAB"/&gt;
   &lt;Setter Property="Foreground" Value="White"/&gt;
   &lt;Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/&gt;
   &lt;Style.Triggers&gt;
     &lt;Trigger Property="Role" Value="TopLevelHeader"&gt;
       &lt;Setter Property="Margin" Value="0,1,0,1"/&gt;
       &lt;Setter Property="Padding" Value="6,3,6,3"/&gt;
       &lt;Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/&gt;
     &lt;/Trigger&gt;
     &lt;Trigger Property="Role" Value="TopLevelItem"&gt;
        &lt;Setter Property="Margin" Value="0,1,0,1"/&gt;
        &lt;Setter Property="Padding" Value="6,3,6,3"/&gt;
        &lt;Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/&gt;
     &lt;/Trigger&gt;
     &lt;Trigger Property="Role" Value="SubmenuHeader"&gt;
        &lt;Setter Property="DockPanel.Dock" Value="Top"/&gt;
        &lt;Setter Property="Padding" Value="0,2,0,2"/&gt;
        &lt;Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/&gt;
     &lt;/Trigger&gt;
     &lt;Trigger Property="Role" Value="SubmenuItem"&gt;
        &lt;Setter Property="DockPanel.Dock" Value="Top"/&gt;
        &lt;Setter Property="Padding" Value="0,2,0,2"/&gt;
     &lt;/Trigger&gt;
   &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  
  &lt;Style x:Key="Menu_LinkForeground" TargetType="{x:Type Hyperlink}"&gt;
   &lt;Setter Property="Foreground" Value="White" /&gt;
   &lt;Setter Property="TextDecorations" Value="None" /&gt;
  &lt;/Style&gt;
  </code></pre>