0

我已经在 Application.Resources 中声明了一个资源,例如

 <sys:String x:Key="DecimalFormat">\{0:F2\}</sys:String>

现在在文本框中,我将此静态资源作为 StringFormat 提供,但它不起作用。我还尝试了 stringFormat 应用程序中断的绑定。有什么我想让 stringformat 动态的吗?

4

1 回答 1

0

定义为资源时使用不带斜线的

<sys:String x:Key="DecimalFormat">{0:F2}</sys:String>

<TextBlock Text="{Binding MyDecimal, StringFormat={StaticResource DecimalFormat}}"  />
于 2013-07-17T22:31:39.017 回答