问题描述
嗨!
我已经成功创建了一个在行标题中具有行号的数据网格.但是,它坚持左对齐行标题内容,我一辈子都无法弄清楚如何让它居中对齐.
I have successfully created a datagrid with rownumbers in the row header. But, it insists on left aligning the row header content and I cannot for the life of me figure out how to tell it to center align it instead.
/Må ns Tå nneryd
/Måns Tånneryd
推荐答案
<DataGridTextColumnHeader="Name"Binding="{Binding Name}"IsReadOnly="True">
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumnHeader="Name"Binding="{Binding Name}"IsReadOnly="True">
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
这篇关于在datagrid行标题中对齐内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!