在WPF的DataGrid文本对齐 [英] Text alignment in a WPF DataGrid

查看:844
本文介绍了在WPF的DataGrid文本对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何调整列的数据中心在WPF 的DataGrid

How can I align the column data to center in a WPF DataGrid?

推荐答案

这很难不知道具体的说,但这里有一个 DataGridTextColumn 为中心:

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>

这篇关于在WPF的DataGrid文本对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆