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="{StaticResource 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
HorizontalAlignmentthat you can set on the column, instead you’ll need to construct aStylesimilar to what you have in XAML, and apply it to the column.