Local settings in Windows Phone 8.1 app are not stored

牧云@^-^@ 提交于 2019-12-13 02:04:44

问题


I have created many apps for Windows Phone 7 and 8. To store settings I was using these methods:

IsolatedStorageSettings.ApplicationSettings["key"] = value;
IsolatedStorageSettings.ApplicationSettings.Save();

Everything worked perfectly, my settings were stored. Save() method did the job.

But now I am creating an app for Windows Phone 8.1 (WinRT). I have followed this guide to learn hot to save settings. Ane here is how it looks like now:

Windows.Storage.ApplicationData.Current.LocalSettings.Values["key"] = value;

But when I close the app and run again, they're gone, my settings are not stored. So my question is: How to save settings in Windows Phone 8.1?


回答1:


This line really works:

 Windows.Storage.ApplicationData.Current.LocalSettings.Values["key"] = value;

The problem is when you're trying to call it via binding in XAML as a property. Then you may have problem with it. Just avoid it, and call this method in code behind explicite.



来源:https://stackoverflow.com/questions/30560722/local-settings-in-windows-phone-8-1-app-are-not-stored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!