【问题标题】:How to format a string with a localized string?如何使用本地化字符串格式化字符串?
【发布时间】:2013-03-17 09:33:12
【问题描述】:

我想绑定一个值并使用本地化字符串对其进行格式化。类似的东西:

<TextBlock Text="{Binding Age, StringFormat='\{0\} {Binding Path=LocalizedResources.Global_AgeSuffix, Source={StaticResource LocalizedStrings}}'}" />

输出:

  • 30 ans if 法国文化
  • 30 年(如果其他文化)

有可能吗?

问候,

弗洛

【问题讨论】:

    标签: string xaml binding formatting windows-phone-8


    【解决方案1】:

    很遗憾,您无法在 Windows Phone 上以这种方式格式化绑定文本。

    有两种选择。

    1. 向已应用格式的绑定对象添加另一个属性
    2. 使用转换器应用格式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-22
      相关资源
      最近更新 更多