我在silverlight中有一个奇怪的问题。我使用以下XAML将标签的内容绑定到我的viewmodel中的double属性。
Content="{Binding FeePeriodActual, Mode=OneWay,StringFormat=\{0:c\}}"
但是,显示字符串始终显示$ Dollar Currency符号而不是£。这在生产服务器和开发机器上是相同的。所有本地化属性都在Web服务器上设置。我无法在silverlight应用程序中看到在哪里更改它。
有人有任何想法吗?
答案 0 :(得分:2)
修改App.xaml.cs中的Application_Startup
方法,如下所示: -
private void Application_Startup(object sender, StartupEventArgs e)
{
Resources.Add("DefaultCulture", System.Globalization.CultureInfo.CurrentCulture);
this.RootVisual = new MainPage();
}
现在,您需要在绑定中使用特定于文化的格式: -
Content="{Binding FeePeriodActual, Mode=OneWay,StringFormat=\{0:c\}, ConverterCulture={StaticResource DefaultCulture}}"