【问题标题】:Isolated Storage Setting (saving & retrieving from different views)隔离存储设置(从不同视图保存和检索)
【发布时间】:2011-12-10 21:09:47
【问题描述】:

我有两个视图(MainPage.xaml 和 Settings.xaml)

我想在我的设置视图中保存一个字符串 并在 MainPage 中检索其内容

这是我的代码,但出现错误:

Settings.xaml.cs:

var settings = IsolatedStorageSettings.ApplicationSettings;
                settings.Add("setPlan", "This is my text that i want to retreive");

MainPage.xaml.cs:

var location = settings["setPlan"].ToString();

错误是:名称“设置”在当前上下文中不存在。

但是这个“setPlan”字符串不是应该在我的沙盒中并且可以从任何视图访问吗?

【问题讨论】:

    标签: c# xaml windows-phone-7 isolatedstorage


    【解决方案1】:

    你不需要:

    var settings = IsolatedStorageSettings.ApplicationSettings; 
    var location = settings["setPlan"].ToString(); 
    

    在MainPage.xaml.cs 中?

    settings 看起来像是在 Settings.xaml.cs 中限定了调用它的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-15
      相关资源
      最近更新 更多