omarmallat
omarmallat

Reputation: 734

change culture using wpflocalizeextension

maybe it's very simple, but how to change the culture in code behind to allow the wpflocalizeextension to show the desired resource?

I tried to change the application culture, but it did nothing!!

Upvotes: 9

Views: 2421

Answers (2)

M.E.
M.E.

Reputation: 2929

In order to change the current culture at runtime you use the following two statements. With SetCurrentThreadCulture, also the culture of the current thread is updated.

WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.Culture = new CultureInfo("en");

To get a list of available CultureInfo objects, you can use

WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.MergedAvailableCultures

Upvotes: 18

CBreeze
CBreeze

Reputation: 2965

Try something like this?

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");

Upvotes: 0

Related Questions