我如何全局设置文化WPF应用程序? [英] How can i globally set the Culture in a WPF Application?
问题描述
我想一个WPF应用程序的文化设定为基于用户的preferences一个具体的问题。
I would like to set the Culture of a WPF application to a specific one based on user preferences.
我可以通过 Thread.CurrentThread.Current(UI)文化
做到这一点当前线程,但有什么办法做到这一点在全球范围的应用程序(所以它在默认情况下会影响所有线程)?
I can do this for the current thread via Thread.CurrentThread.Current(UI)Culture
, but is there any way to do this globally for the application (so it affects all threads by default)?
推荐答案
有没有办法将其设置为应用程序中的所有线程,但如果要创建在应用程序的线程,你可以自己设置的文化给大家正如你上面提到的
there is no way to set it for all threads in the application, however if you are creating the threads in your application you can set the culture for everyone by yourself as you mentioned above
要设置文化到主应用程序使用下面的代码片段code:
To set the Culture to the Main Application use the following snippet code:
Dim newCulture As CultureInfo = new CultureInfo("fr-FR")
CurrentThread.CurrentCulture = newCulture
这篇关于我如何全局设置文化WPF应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!