Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 892
Sander Declerck Avatar asked Apr 15 '11 14:04

Sander Declerck


1 Answers

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.

like image 55
ChrisF Avatar answered Sep 19 '22 17:09

ChrisF