Sander Declerck
Sander Declerck

Reputation: 2535

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}" ContentStringFormat="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?

Upvotes: 5

Views: 4987

Answers (1)

ChrisF
ChrisF

Reputation: 137148

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.

Upvotes: 6

Related Questions