Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: Maskedtextbox define culture for mask

$
0
0
In reply to my posts,

I have figured out that the responsible methods for create the culture of MaskedTextBox, are two methods found in ValueRangeTextBox.cs. In particular:
internal IFormatProvider GetActiveFormatProvider()
    {
      IFormatProvider formatProvider = this.FormatProvider;

      if( formatProvider != null )
        return formatProvider;

      return CultureInfo.CurrentCulture;
    }

    internal CultureInfo GetCultureInfo()
    {
      CultureInfo cultureInfo = this.GetActiveFormatProvider() as CultureInfo;

      if( cultureInfo != null )
        return cultureInfo;

      return CultureInfo.CurrentCulture;
    }
Since I have managed to pass a FormatProvider as new CultureInfo("en-GB") in my previous post, I can't see why it doesn't work and the mask still behaves based on CultureInfo.CurrentCulture.

I changed those two methods to always return new CultureInfo("en-GB") and the Toolkit LiveExplorer works as I finally expect. Despite my CurrentCulture being "el-GR", it respects the "en-GB" and displays a dot for decimal point (it's a comma in "el-GR").

Maybe my solution is to recompile the binary and include it in my project, skipping the nuget package, which by the way seems to be behind the latest community 2.2 version.

Just posting, in case anyone has more insight or simply has a similar problem.

Viewing all articles
Browse latest Browse all 2157

Trending Articles



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