'String.Format, Currency, Polish Złoty
I am developing an e-commerce administration panel in WPF. I would like to display currency values in PLN (Polish Złoty). Format {0:C} gives output in USD ($1.000). Is there a way to change this behaviour or do I have to write my custom format to accomplish this?
edit: Why this is so if my windows culture info and location are both set to Polish/Poland?
Solution 1:[1]
Try to pass CultureInfo in your String Format.
string money = String.Format(CultureInfo.GetCultureInfo("pl"), "{0:C}", 30.7m);
Console.WriteLine(money);
EDIT: if you are in WPF then this should do the trick:
this.Language = XmlLanguage.GetLanguage("pl");
or
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("pl")));
Solution 2:[2]
You sholud add only xml:lang="pl-PL"
in your <Window>
tag in MainWindows.xaml. Simple as that!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Benji |