Wpf NumberFormatInfo.CurrentInfo.CurrencySymbol在XAML中未被识别为静态属性

Wpf NumberFormatInfo.CurrentInfo.CurrencySymbol在XAML中未被识别为静态属性,wpf,xaml,globalization,Wpf,Xaml,Globalization,我正在编写一个WPF应用程序,其中我希望在表单上显示所选区域性的货币符号 所以我添加了这个文本块 <TextBlock Text="{x:Static globalization:NumberFormatInfo.CurrentInfo.CurrencySymbol}" Style="{StaticResource TextStyle}" VerticalAlignment="Center"/> 编译器抱怨无法找到NumberFormatInfo.CurrentInfo,尽管这

我正在编写一个WPF应用程序,其中我希望在表单上显示所选区域性的货币符号

所以我添加了这个文本块

<TextBlock Text="{x:Static globalization:NumberFormatInfo.CurrentInfo.CurrencySymbol}" Style="{StaticResource TextStyle}" VerticalAlignment="Center"/>

编译器抱怨无法找到NumberFormatInfo.CurrentInfo,尽管这是公共类中的静态属性。 以相同的形式,我能够从相同的命名空间成功地引用CultureInfo.CurrentCulture。这确认了我的名称空间声明中没有任何错误

我的解决方法是为textblock提供一个x:Name,然后从后面的代码中分配它的文本,但我希望用正确的方法来完成

谢谢,
Fadi

仔细阅读错误消息,它指出问题所在:

找不到类型“NumberFormatInfo.CurrentInfo”

它正在查找类型为
NumberFormatInfo.CurrentInfo
的属性
CurrencySymbol
,该属性不存在。要绑定到该属性,可以使用
CurrentInfo
作为
绑定的源:

Text="{Binding Source={x:Static globalization:NumberFormatInfo.CurrentInfo}, Path=CurrencySymbol}"

非常感谢。吸取的教训是,x:Static的格式是固定的“namespace:Class.Property”