Silverlight DataGrid标题水平对齐 [英] Silverlight DataGrid Header Horizontal Alignment

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

问题描述

我想更改Silverlight中datagrid上的标题对齐方式,我似乎无法弄清楚如何做到这一点。这是我到目前为止:

I want to change the alignment of a header on a datagrid in Silverlight, and I can't seem to figure out how to do it. Here's what I have so far:

  <data:DataGridTextColumn Header="#" 
                            IsReadOnly="True"
                            ElementStyle="{StaticResource CenterAlignStyle}" 
                            Binding="{Binding OutlineNumber, Mode=OneWay}" >
    <data:DataGridTextColumn.HeaderStyle>
      <Style TargetType="prim:DataGridColumnHeader">
        <Setter Property="HorizontalAlignment" Value="Center"/>
      </Style>
    </data:DataGridTextColumn.HeaderStyle>
  </data:DataGridTextColumn>

无论我尝试什么,我似乎无法更改默认对齐方式,这似乎是左。

No matter what I try, I can't seem to change the default alignment, which appears to be "left."

推荐答案

你真的很亲密,它的: -

You were really close, its:-

<Setter Property="HorizontalContentAlignment" Value="Center"/>

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

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