12

I've bound a TextBox to a Decimal. My problem ist, the Binding is using american numerical standards, using a dot for decimals separation ("1.5")

My system is german and configured to use a comma as decimals separation ("1,5").

I need the TextBox binding to show and use a comma instead of a dot to separate decimals.

How do I get the binding to respect the currently set localization/culture settings for numerical input?

Tomas Karban
  • 1,080
  • 8
  • 24
Sam
  • 28,421
  • 49
  • 167
  • 247

1 Answers1

19

Read this article. You should set default language for all framework elements:

public partial class App : Application
{
    static App()
    {
        FrameworkElement.LanguageProperty.OverrideMetadata(
            typeof(FrameworkElement),
            new FrameworkPropertyMetadata(
                XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
    }
}
vortexwolf
  • 13,967
  • 2
  • 54
  • 72
  • For Silverlight check [How to set Silverlight CurrentUICulture/CurrentCulture correctly](http://stackoverflow.com/questions/9162050/how-to-set-silverlight-currentuiculture-currentculture-correctly/39387166#39387166) – pawciu Sep 08 '16 at 09:24