【问题标题】:Changing culture of XamDataGrid cell values更改 XamDataGrid 单元格值的区域性
【发布时间】:2016-10-06 04:08:14
【问题描述】:

我有一个带有一列浮点数的 XamDataGrid,我希望这些浮点数与 InvariantCulture 一起显示,即用点而不是逗号。我该怎么做?

【问题讨论】:

  • XamDataGrind 是否有 DataFormatString 属性..?如果是这样,您可以在 <Columns> 模板中尝试以下操作。DataFormatString="{0:###.000}" 这将精确到 3 decimal places 请显示您的 ItemTemplate 的样子谢谢
  • XamDataGrid 中没有 DataFormatString 属性。 ItemTemplate 是什么意思?
  • 如果您不熟悉ItemTemplate,这就是谷歌的用途.. 还可以尝试查看XamDataGrid 的文档/示例.. 祝你好运
  • @MethodMan:我做到了,这就是我在这里问的原因。无论如何,谢谢。

标签: c# wpf infragistics xamdatagrid invariantculture


【解决方案1】:
  1. XamDataGrid 控件中的任何列都继承自已支持 InvariantCulture 格式的Infragistics.Windows.DataPresenter.Field 类。因此,任何浮点类型数据都将使用当前区域格式设置显示。

  2. 如果需要以某种特定格式格式化数据,可以提供相应的转换器,如下所示:

    <igDP:Field x:Name="Total" Converter="{StaticResource TotalFormatConverter}"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多