我已经创建了一个表,如下
DataTable table= new DataTable();
其中,我在一行中逐行添加数据,第一列是row.But,其他列是数字。我想要将第一列向左对齐,并将数字与right.Is对齐,有什么方法可以在添加到行中时对齐单元格?
发布于 2014-07-02 18:13:52
在……里面
<Window.Resources>
编写以下代码:
<Style x:Key="RightCellStyle" TargetType="{x:Type telerik:GridViewCell}">
<Setter Property="HorizontalAlignment" Value="Right">
</Setter>
</Style>
<Style x:Key="LeftCellStyle" TargetType="{x:Type telerik:GridViewCell}">
<Setter Property="HorizontalAlignment" Value="Left">
</Setter>
</Style>
在……里面
<telerik:RadGridView.Columns>
编写以下代码,即设置单元格的样式
<telerik:GridViewDataColumn Header="Your header" CellStyle="{StaticResource LeftCellStyle }"></telerik:GridViewDataColumn>
对于想要右对齐的单元格也是如此;只需设置
CellStyle="{StaticResource RightCellStyle }"
告诉我这是否是你要找的东西?
https://stackoverflow.com/questions/24525364
复制相似问题