WPF TextBox binding to decimal respecting culture

后端 未结 1 1615

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

相关标签:
1条回答
  • 2021-02-14 01:05

    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)));
        }
    }
    
    0 讨论(0)
提交回复
热议问题