I have a DataGrid, that references another style that sets the property for the ColumnHeaderStyle to be centered.
<Style x:Key="CenterDataGridStyle" TargetType="{x:Type DataGrid}">
<Style.Setters>
<Setter Property="ColumnHeaderStyle" Value="{St开发者_如何转开发aticResource CenterColumnHeaderStyle}"/>
</Style.Setters>
</Style>
Is there a way in the code behind to make the DataGrid have its first column to be left-justified instead of center? I got so far as:
dtGridReads.Columns[0].
then I'm not sure if there was a property I could set for this or not? Thanks.
There is not a single property like HorizontalAlignment
that you can set on the column, instead you'll need to construct a Style
similar to what you have in XAML, and apply it to the column.
精彩评论