title: How to Set style for DataGrid header in WPF
body: <p>I have a <code>DataGrid</code> like this:</p>
  
  <pre><code>&lt;DataGrid AutoGenerateColumns="False"  
            Height="221" 
            HorizontalAlignment="Center" 
            VerticalContentAlignment="Center" 
            HorizontalContentAlignment="Center" 
            Margin="6,269,0,0" 
            Name="dataGrid1" 
            VerticalAlignment="Center" 
            Width="875" 
            SelectionChanged="dataGrid1_SelectionChanged"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn x:Name="Id" 
                              Header="ID"
                              Binding="{Binding Path=Key}" 
                              HeaderStyle="" /&gt;
          &lt;DataGridTemplateColumn Header="Image" 
                                  Width="SizeToCells" 
                                  IsReadOnly="True" 
                                  MinWidth="80"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Image Width="16" 
                             Height="16"
                             Source="{StaticResource MyImageSource}"
                             HorizontalAlignment="Center" 
                             VerticalAlignment="Center"/&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>How I can center <code>DataGrid Header</code>? and apply style for it?</p>
  
  <p>thanks</p>
  
  <hr>
  
  <p>Edit 1):</p>
  
  <p>after write this code:</p>
  
  <pre><code>&lt;DataGrid.ColumnHeaderStyle&gt;
      &lt;Style TargetType="{x:Type DataGridColumnHeader}"&gt;
          &lt;Setter Property="FontWeight"  Value="Bold" /&gt;
          &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt;
          &lt;Setter Property="HorizontalContentAlignment" Value="Center" /&gt;
      &lt;/Style&gt;
  &lt;/DataGrid.ColumnHeaderStyle&gt;
  </code></pre>
  
  <p>grid columns become :</p>
  
  <p><img src="https://i.stack.imgur.com/BYtmj.png" alt="enter image description here"></p>
  
  <p>Why?</p>