Use "real" CultureInfo.CurrentCulture in WPF Binding, not CultureInfo from IetfLanguageTag
You can create a subclass of binding (e.g. CultureAwareBinding) which sets the ConverterCulture automatically to the current culture when created.
It's not a perfect solution, but it's probably the only one, since retroactively forcing Binding to respect the culture could break other code in WPF which depends on this behavior.
Let me know if you need more help!
This is an extension of answer from aKzenT. They proposed that we should create a subclass of Binding class and set the ConverterCulture to CurrentCulture. Even though the answer is very straight forward, I feel some people may not be very comfortable implementing it, so I am sharing the code version of aKzenT's answer with an example of how to use it in XAML.
using System;
using System.Globalization;
using System.Windows.Data;
namespace MyWpfLibrary
{
public class CultureAwareBinding : Binding
{
public CultureAwareBinding()
{
ConverterCulture = CultureInfo.CurrentCulture;
}
}
}
Example of how to use this in XAML
1) You need to import your namespace into your XAML file:
<Page
...
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:myWpfLib="clr-namespace:MyWpfLibrary;assembly=<assembly_name>"
...
>
2) Real world usage of the CultureAwareBinding
<Textblock Text="{myWpfLib:CultureAwareBinding Path=Salary, Source=Contact, StringFormat={}{0:C}}" />
Put the following line of code, before any UI is initialized. This worked for me.
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
(And remove all explicit culture parameters)