2012-08-08 72 views
0

如何閱讀MainPage.xaml/.cs中的設置?如何從獨立存儲中讀取其他課程?

我用這個setting sample但我沒有accces去/從其他類。

例如:在MainPage.xaml中我們有TextBlock,在SettingsWithoutConfirmation.xaml中我們有TextBox,TextBlock如何從TextBox中讀取這個字符串(並將其保存到獨立存儲)?

我是新手,請溫柔;)

回答

0

我不知道我完全瞭解你的問題。 在任何XAML頁面,則可以使用下面的方法已經被存儲在獨立存儲訪問設置:

var settings = IsolatedStorageSettings.ApplicationSettings; 
if(settings.Contains("name")) { 
    //the value is available here 
} 

//to store a value permanently 
settings["name"] = "New Name" 
0

試試這個:

保存數據設置:

var settings = IsolatedStorageSettings.ApplicationSettings; 
settings.Add("myemail", "[email protected]"); 

獲取數據來自設置:

var location = settings["myemail"].ToString(); 
settings["myemail"] = "[email protected]";