Reputation: 1288
I have two views (MainPage.xaml & Settings.xaml)
I want to save a string in my Settings view & retrieve its content in the MainPage
Here's my code, but i'm getting an error:
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();
THE ERROR IS :The name 'settings' does not exist in the current context.
But isn't this "setPlan" string supposed to be in my sandBox and accessible from any view?
Upvotes: 0
Views: 323
Reputation: 9478
Don't you need:
var settings = IsolatedStorageSettings.ApplicationSettings;
var location = settings["setPlan"].ToString();
in MainPage.xaml.cs
?
settings
looks like it's scoped to the method it's being called from, in Settings.xaml.cs.
Upvotes: 1