My current culture is ru-RU. I need it to format decimal to currency string.
decimal n = 111.22M;
n.ToString("C") will return "111,22р."
but when I try to use StringFormat field of a binding I get a "$111.22" result
<TextBlock Text={Binding Number, StringFormat=C} />
By default, WPF will use English as the culture for binding StringFormat
processing, not the thread's current culture.
You can override this by adding the following in the application's startup code:
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
new FrameworkPropertyMetadata( XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
For details, see Josh Smith's article on Creating an Internationalized Wizard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With