改变语言并重新刷新界面
Posted 天马行空
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了改变语言并重新刷新界面相关的知识,希望对你有一定的参考价值。
>>"for example i will change application language in settings.xaml so i want to restart appication or go to App.cs constructor again without exit ?"
If your app is Universal Windows Phone 8.1 runtime app, because the pages and controls that are already rendered are cached, we can use ResourceContext.Reset methods to update text of all custom controls at runtime without restarting the app. For example:
var NewLanguage = (string)((ComboBoxItem)e.AddedItems[0]).Tag;
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = NewLanguage;
Windows.ApplicationModel.Resources.Core.ResourceContext.GetForViewIndependentUse().Reset();
Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Reset();
After that, reload your Page, using Navigate method:
if (Frame != null)
Frame.Navigate(typeof(MyPage));
以上是关于改变语言并重新刷新界面的主要内容,如果未能解决你的问题,请参考以下文章