Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Maskedtextbox define culture for mask

$
0
0
I managed to bind a FormatProvider like this:
  1. Create a class called MyCultureInfo that exposes a static CultureInfo MyCulture which always returns a new CultureInfo("en-GB"):
  2. 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.

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>