I have a little problem with the current format of my negative currency number. Here's a screenshot resuming my situation.
Why the result isn't -0,08 $ ?
Any ideas of how I should proceed?
Thanks for your time.
UPDATE:
I tried to resolve the problem with a converter, here's the result :
Thread.CurrentThread.CurrentUICulture
was not the same as the Thread.CurrentThread.CurrentCulture
, so I fixed it in my App.xaml.cs. Unfortunately, same result.Convert
method was okay, but its CurrentNegativePattern
was not the same as in the Thread.CurrentThread.CurrentCulture
. That's probably the reason why I have this problem. for the moment, I'll use this : return ((double)value).ToString("C2", Thread.CurrentThread.CurrentCulture);
in the Convert
method of my converter.Try changing the CurrentCulture
to CurrentUICulture
:
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentUICulture.IetfLanguageTag))
);
Please note though that this may not use your regional settings. The CultureInfo
object does describe your regional settings, but what you're doing with the IetfLanguageTag
is extracting that to a specific culture. That culture does not have the adjustments you've made to your regional settings.
Alternatively, you can have a look at the ConvertCulture
option of the binding. This actually does take a CultureInfo
.
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