互联网上的所有文章都表明,为了使XAML在运行系统中能够检测到某些文化,应当使用这一条线。
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata((XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))));
The problem is that the regional settings in windows allow the user to customize the formatting of dates and numbers in any way the user wants. For example, lets say that the user wants to 3 decimal digits instead of 2. he goes to the regional settings and makes this update. The problem is that this change is not picked up in Xaml binding
<TextBlock Text="{Binding Payments, StringFormat=C}" /> <!--display 2 digits-->
在后面的法典中,如果使用“TString”(“C”),那么无论在服务器方面,都能够成功地实现任何定制。
decimal sampleNumber = 1.123;
string s = sampleNumber.ToString("C"); //Puts 3 digits in the string variable
My workaround is to use a custom converter where i do the ToString and return the string to the binding. But it is weird that i haven t seen this problem (which is most probably a bug in WPF) posted anywhere on the net. Am i missing something?