开发者

WPF Formatting string as currency using the € symbol

I've got an application where I need to show a price, for that, I have the following code:

<Label Content="{Binding Prijs}" ContentSt开发者_运维百科ringFormat="C"></Label>

However, that gives a stringformat like: $10.00, but i want to show the euro-sign (€) instead of the dollar-sign ($). How do I do that?


You need to make sure that the Language of the control is set correctly.

Tim Heuer has a blog post entitled "StringFormat and CurrentCulture in Silverlight" about this for Silverlight so I expect the same problem occurs in WPF.

The solution for Silverlight is to add the following line to the view constructor:

this.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);

Now for WPF you might just need to make sure that the CurrentThread.CurrentCulture is set correctly, if not try adding this line too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜