Silverlight DataGrid Header Horizontal Alignment

Posted by Brandon Montgomery on Stack Overflow See other posts from Stack Overflow or by Brandon Montgomery
Published on 2010-03-11T16:54:44Z Indexed on 2010/03/11 17:39 UTC
Read the original article Hit count: 781

Filed under:
|

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."

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about datagrid