Application Settings in Windows Phone

By | July 19, 2013

Application Settings is the most useful and easiest way to store and access data in Windows Phone, it is a wonderful name value pair dictionary. If we want to store setting we use the ApplicationSettings object in Isolated Storage. Basically it is used for properties, settings and other commonly used data in your application.

Saving Data

private void saveData(string message)
{
IsolatedStorageSettings.ApplicationSettings["score"] = message;
IsolatedStorageSettings.ApplicationSettings.Save();
}

Load Data

private string loadData()
{
if (IsolatedStorageSettings.ApplicationSettings.Contains("score"))
{
return (string)IsolatedStorageSettings.ApplicationSettings["score"];
}
else
return null;
}

It is as simple as the code seems above, lets see a quick demo on how it works.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.