Hi all,
I'm using WPF datagrid which is bundled in WPF toolkit... the problem is I'm not able to align some column data to center
Please help me guys
Hi all,
I'm using WPF datagrid which is bundled in WPF toolkit... the problem is I'm not able to align some column data to center
Please help me guys
It's hard to say without knowing specifics, but here's a DataGridTextColumn
that is centered:
<wpf:DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True">
<wpf:DataGridTextColumn.CellStyle>
<Style>
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Center"/>
</Style>
</wpf:DataGridTextColumn.CellStyle>
</wpf:DataGridTextColumn>
HTH, Kent
Ok, I used the frameworkElement approach but there was a strange behavior when you try to highlight the row.
I've put another example of WPF Datagrid alignment in this thread!
If you are using DataGridTextColumn you can use the following code snippet:
<Style TargetType="DataGridCell">
<Style.Setters>
<Setter Property="TextBlock.TextAlignment" Value="Right" />
</Style.Setters>
</Style>