I have a WPF DataGrid with a column header as follows:
...
H.B's answer is correct; just add one more line:
<DataGridTextColumn.HeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style>
</DataGridTextColumn.HeaderStyle>
Set the HorizontalContentAlignment
of the header using the HeaderStyle
:
<DataGridTemplateColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style>
</DataGridTemplateColumn.HeaderStyle>