首页 > 编程语言 > 详细

改变语言并重新刷新界面

时间:2016-06-10 13:40:29      阅读:241      评论:0      收藏:0      [点我收藏+]

>>"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));

改变语言并重新刷新界面

原文:http://www.cnblogs.com/qianblue/p/5573585.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!