Julien
Julien

Reputation: 373

Switching language at runtime in Windows Store Apps

In my Windows Store App application I have an option to switch the language by setting ApplicationLanguages.PrimaryLanguageOverride to the locale I want to use.

I have different resource files for each language and it works fine for reloaded pages and resources loaded from code-behind.

But now there is a problem with cached pages (NavigationCacheMode = Enabled): those pages have text localized directly in xaml using uids, and those don't get reloaded when the language changes.

Any idea how to reload those resource tagged as uids without restarting the app?

Upvotes: 3

Views: 589

Answers (1)

Jmie
Jmie

Reputation: 117

For me worked deleting the Navigationcache like that after switching the primarylanguageoverride:

    var Frame = Window.Current.Content as Frame;
    Frame.CacheSize = 0;
    Frame.Navigate(Frame.CurrentSourcePageType);
    Frame.CacheSize = 10;
    Frame.GoBack();

After that the Current Page is reloaded in the correct language.

Upvotes: 2

Related Questions