XamDataGrid:我有两列(显示十进制数据):我想要一列带有“$”的列标志,一个没有。如何?
我有两个 decimal
数据类型列;我希望它们像这样显示:
- 前面有无“$”符号
- 第 1 列 (
ColumnWithNoDollarSign
) 将在值第 2 列 (ColumnWithDollarSign
) 值前面会有一个“$”符号
这是我的 XAML 当前的样子:
<ig:XamDataGrid Name="xamDataGrid"
IsGroupByAreaExpanded="False"
DataSource="{Binding Rows, Mode=OneWay}">
<ig:XamDataGrid.Resources>
<Style TargetType="{x:Type Editors:XamNumericEditor}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="FontSize" Value="12" />
</Style>
<Style TargetType="{x:Type Editors:XamCurrencyEditor}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="FontSize" Value="12" />
</Style>
</ig:XamDataGrid.Resources>
<ig:XamDataGrid.FieldLayoutSettings>
<ig:FieldLayoutSettings AutoGenerateFields="False"/>
</ig:XamDataGrid.FieldLayoutSettings>
<ig:XamDataGrid.FieldLayouts>
<ig:FieldLayout Key="layout">
<ig:Field Name="ColumnWithNoDollarSign" Label="Column 1"/>
<ig:Field Name="ColumnWithDollarSign" Label="Column 1"/>
</ig:FieldLayout>
</ig:XamDataGrid.FieldLayouts>
</ig:XamDataGrid>
据我所知,问题是我应用的 XamCurrencyEditor
样式覆盖了所有 小数
列。我只希望它覆盖 decimal
列之一。我该怎么做呢?
I have two decimal
datatype columns; I want them displayed like so:
- Column 1 (
ColumnWithNoDollarSign
) will have no "$" sign in front of the values - Column 2 (
ColumnWithDollarSign
) will have a "$" sign in front of the values
This is what my XAML currently looks like:
<ig:XamDataGrid Name="xamDataGrid"
IsGroupByAreaExpanded="False"
DataSource="{Binding Rows, Mode=OneWay}">
<ig:XamDataGrid.Resources>
<Style TargetType="{x:Type Editors:XamNumericEditor}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="FontSize" Value="12" />
</Style>
<Style TargetType="{x:Type Editors:XamCurrencyEditor}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="FontSize" Value="12" />
</Style>
</ig:XamDataGrid.Resources>
<ig:XamDataGrid.FieldLayoutSettings>
<ig:FieldLayoutSettings AutoGenerateFields="False"/>
</ig:XamDataGrid.FieldLayoutSettings>
<ig:XamDataGrid.FieldLayouts>
<ig:FieldLayout Key="layout">
<ig:Field Name="ColumnWithNoDollarSign" Label="Column 1"/>
<ig:Field Name="ColumnWithDollarSign" Label="Column 1"/>
</ig:FieldLayout>
</ig:XamDataGrid.FieldLayouts>
</ig:XamDataGrid>
The problem, as I see it, is that the XamCurrencyEditor
style I am applying is overriding all decimal
columns. I only want it to override one of the decimal
columns. How would I go about doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XamNumericEditor 是否表示不带 $ 的格式?如果是这样,您是否可以不只指定每个列使用的样式,即:
尽管我建议将所有样式信息移动到单个文件(例如 App.xaml),而不是在多个位置重新定义它。
Does the XamNumericEditor represent the format without the $? If so, can you not just specify the style used by each column, ie do:
Although I would recommend moving all style info to a single file, such as App.xaml, rather than re-defining it in multiple places.