title: Align DataGrid Column Header to Center
body: <p>I need to align <code>WPF DataGrid Column Header</code> text to <strong>Center</strong>. I created a style and attached that using the <code>HeaderStyle</code> property as below.</p>
  
  <p><strong>Style</strong></p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;Style x:Key="CenterGridHeaderStyle" TargetType="DataGridColumnHeader"&gt;
          &lt;Setter Property="HorizontalContentAlignment" Value="Center"/&gt;
      &lt;/Style&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p><strong>Column</strong></p>
  
  <pre><code>&lt;DataGridTextColumn 
     Binding="{Binding Path=Name}" Header="Name" IsReadOnly="True" 
     HeaderStyle="{DynamicResource CenterGridHeaderStyle}"/&gt;
  </code></pre>
  
  <p>But this does not align Column Header text to the Center. How can I do this?</p>