使用本地区域设置来绑定的字符串格式 [英] Using local Regional settings for binding's stringformat

查看:55
本文介绍了使用本地区域设置来绑定的字符串格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望WPF使用我的Windows区域设置,而不是我在代码中设置的区域性.

I want WPF to use my Windows Regional Settings, not a culture I set in code.

我正在使用以下代码来获取WPF来关心我的文化设置:

I'm using the following code to get WPF to care about my culture settings:


      FrameworkElement.LanguageProperty.OverrideMetadata(  typeof(FrameworkElement),
                                  new FrameworkPropertyMetadata(
                                    System.Windows.Markup.XmlLanguage.GetLanguage(
                                      System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag)));

推荐答案

Pieter Muller,

Hi Pieter Muller,

您可以使用 CurrentCulture CurrentUICulture CultureInfo 的属性.它们是静态属性,并赋予系统本地文化.

You can use the CurrentCulture and CurrentUICulture properties of CultureInfo . They are static properties and gives the local culture on the system.

http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx

http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx

谢谢,
穆罕默德
shujaatsiddiqi.blogspot.com

Thanks,
Muhammad
shujaatsiddiqi.blogspot.com


这篇关于使用本地区域设置来绑定的字符串格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆