如何在Dev Express网格上居中标题

本文关键字:标题 网格 Express Dev | 更新日期: 2023-09-27 18:14:31

在以下Dev Express网格中,他们想要将标题居中,目前它们是向左倾斜的。"设施"、"国家"等如何居中?

<dxg:GridControl x:Name="grid"
                     ItemsSource="{Binding Summary}">
        <dxg:GridControl.Columns>
            <dxg:GridColumn FieldName="Facility"
                            dxg:BandedViewBehavior.Column="0"
                            dxg:BandedViewBehavior.Row="0"
                            dxg:BandedViewBehavior.RowSpan="2"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="State"
                            dxg:BandedViewBehavior.Column="1"
                            dxg:BandedViewBehavior.ColumnSpan="3"
                            dxg:BandedViewBehavior.IsBand="True"
                            HorizontalHeaderContentAlignment="Center"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="CNA"
                            EditSettings="{StaticResource TimeSpanEditSettings}"
                            FieldName="StateAide"
                            dxg:BandedViewBehavior.Column="1"
                            dxg:BandedViewBehavior.Row="1"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="LPN"
                            EditSettings="{StaticResource TimeSpanEditSettings}"
                            FieldName="StateLpn"
                            dxg:BandedViewBehavior.Column="2"
                            dxg:BandedViewBehavior.Row="1"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="RN"
                            EditSettings="{StaticResource TimeSpanEditSettings}"
                            FieldName="StateRn"
                            dxg:BandedViewBehavior.Column="3"
                            dxg:BandedViewBehavior.Row="1"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="Federal"
                            FieldName=""
                            dxg:BandedViewBehavior.Column="4"
                            dxg:BandedViewBehavior.ColumnSpan="3"
                            dxg:BandedViewBehavior.IsBand="True"
                            HorizontalHeaderContentAlignment="Center"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="CNA"
                            EditSettings="{StaticResource TimeSpanEditSettings}"
                            FieldName="FederalAide"
                            dxg:BandedViewBehavior.Column="4"
                            dxg:BandedViewBehavior.Row="1"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="LPN"
                            EditSettings="{StaticResource TimeSpanEditSettings}"
                            FieldName="FederalLpn"
                            dxg:BandedViewBehavior.Column="5"
                            dxg:BandedViewBehavior.Row="1"
                            HeaderTemplate="{StaticResource productHeader}" />
            <dxg:GridColumn Header="RN"
                            EditSettings="{StaticResource TimeSpanEditSettings}"
                            FieldName="FederalRn"
                            dxg:BandedViewBehavior.Column="6"
                            dxg:BandedViewBehavior.Row="1"
                            HeaderTemplate="{StaticResource productHeader}" />
        </dxg:GridControl.Columns>

如何在Dev Express网格上居中标题

我在WPF中尝试了这一点,并设置了HorizontalHeaderContentAlignment取得了结果。也许模板中有什么东西覆盖了它?如果你删除模板,它会工作吗?如果是,请尝试在模板中设置该属性。