I want to change the alignment of a header on a datagrid in Silverlight, and I can't seem to figure out how to do it. Here's what I have so far:
<data:DataGridTextColumn Header="#"
IsReadOnly="True"
ElementStyle="{StaticResource CenterAlignStyle}"
Binding="{Binding OutlineNumber, Mode=OneWay}" >
<data:DataGridTextColumn.HeaderStyle>
<Style TargetType="prim:DataGridColumnHeader">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</data:DataGridTextColumn.HeaderStyle>
</data:DataGridTextColumn>
No matter what I try, I can't seem to change the default alignment, which appears to be "left."
You were really close, its:-
<Setter Property="HorizontalContentAlignment" Value="Center"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With