I managed to bind a FormatProvider like this:
I inspect its properties and I actually see FormatProvider = "en-GB".
But the decimal point still translates to a comma, since my system's region is Greek "el-GR".
Let me point that I always want to display a dot instead of a comma, without changing my application's culture.
-
Create a class called MyCultureInfo that exposes a static CultureInfo MyCulture which always returns a new CultureInfo("en-GB"):
-
Then I use Binding Source in the FormatProvider Property of MaskedTextBox to bind to the static MyCulture as below:
FormatProvider="{Binding Source={x:Static cult:MyCultureInfo.MyCulture }}"
Since I'm using Caliburn.Micro, I override the OnViewAttached event of my Screen, and I search for my MaskedTextBox by its given Name.I inspect its properties and I actually see FormatProvider = "en-GB".
But the decimal point still translates to a comma, since my system's region is Greek "el-GR".
Let me point that I always want to display a dot instead of a comma, without changing my application's culture.