Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:07:45+00:00 2026-06-03T07:07:45+00:00

I am trying to create a settings page for my windows phone 7 application

  • 0

I am trying to create a settings page for my windows phone 7 application and i am using this article as the basis http://msdn.microsoft.com/en-us/library/ff769510(v=vs.92).aspx so my application class is :

 public class AppSettings
{

    // Our isolated storage settings
    IsolatedStorageSettings isolatedStore;

    // The isolated storage key names of our settings
    const string CheckBoxSettingKeyName = "CheckBoxSetting";
    const string ListBoxSettingKeyName = "ListBoxSetting";
    const string RadioButton1SettingKeyName = "RadioButton1Setting";
    const string RadioButton2SettingKeyName = "RadioButton2Setting";
    const string RadioButton3SettingKeyName = "RadioButton3Setting";
    const string UsernameSettingKeyName = "UsernameSetting";
    const string PasswordSettingKeyName = "PasswordSetting";

    // The default value of our settings
    const bool CheckBoxSettingDefault = true;
    const int ListBoxSettingDefault = 0;
    const bool RadioButton1SettingDefault = true;
    const bool RadioButton2SettingDefault = false;
    const bool RadioButton3SettingDefault = false;
    const string UsernameSettingDefault = "";
    const string PasswordSettingDefault = "";

    /// <summary>
    /// Constructor that gets the application settings.
    /// </summary>
    public AppSettings()
    {
        try
        {
            // Get the settings for this application.
            isolatedStore = IsolatedStorageSettings.ApplicationSettings;

        }
        catch (Exception e)
        {
            Debug.WriteLine("Exception while using IsolatedStorageSettings: " + e.ToString());
        }
    }

    /// <summary>
    /// Update a setting value for our application. If the setting does not
    /// exist, then add the setting.
    /// </summary>
    /// <param name="Key"></param>
    /// <param name="value"></param>
    /// <returns></returns>
    public bool AddOrUpdateValue(string Key, Object value)
    {
        bool valueChanged = false;

        // If the key exists
        if (isolatedStore.Contains(Key))
        {
            // If the value has changed
            if (isolatedStore[Key] != value)
            {
                // Store the new value
                isolatedStore[Key] = value;
                valueChanged = true;
            }
        }
        // Otherwise create the key.
        else
        {
            isolatedStore.Add(Key, value);
            valueChanged = true;
        }

        return valueChanged;
    }


    /// <summary>
    /// Get the current value of the setting, or if it is not found, set the 
    /// setting to the default setting.
    /// </summary>
    /// <typeparam name="valueType"></typeparam>
    /// <param name="Key"></param>
    /// <param name="defaultValue"></param>
    /// <returns></returns>
    public valueType GetValueOrDefault<valueType>(string Key, valueType defaultValue)
    {
        valueType value;

        // If the key exists, retrieve the value.
        if (isolatedStore.Contains(Key))
        {
            value = (valueType)isolatedStore[Key];
        }
        // Otherwise, use the default value.
        else
        {
            value = defaultValue;
        }

        return value;
    }


    /// <summary>
    /// Save the settings.
    /// </summary>
    public void Save()
    {
        isolatedStore.Save();
    }


    /// <summary>
    /// Property to get and set a CheckBox Setting Key.
    /// </summary>
    public bool CheckBoxSetting
    {
        get
        {
            return GetValueOrDefault<bool>(CheckBoxSettingKeyName, CheckBoxSettingDefault);
        }
        set
        {
            AddOrUpdateValue(CheckBoxSettingKeyName, value);
            Save();
        }
    }


    /// <summary>
    /// Property to get and set a ListBox Setting Key.
    /// </summary>
    public int ListBoxSetting
    {
        get
        {
            return GetValueOrDefault<int>(ListBoxSettingKeyName, ListBoxSettingDefault);
        }
        set
        {
            AddOrUpdateValue(ListBoxSettingKeyName, value);
            Save();
        }
    }


    /// <summary>
    /// Property to get and set a RadioButton Setting Key.
    /// </summary>
    public bool RadioButton1Setting
    {
        get
        {
            return GetValueOrDefault<bool>(RadioButton1SettingKeyName, RadioButton1SettingDefault);
        }
        set
        {
            AddOrUpdateValue(RadioButton1SettingKeyName, value);
            Save();
        }
    }


    /// <summary>
    /// Property to get and set a RadioButton Setting Key.
    /// </summary>
    public bool RadioButton2Setting
    {
        get
        {
            return GetValueOrDefault<bool>(RadioButton2SettingKeyName, RadioButton2SettingDefault);
        }
        set
        {
            AddOrUpdateValue(RadioButton2SettingKeyName, value);
            Save();
        }
    }

    /// <summary>
    /// Property to get and set a RadioButton Setting Key.
    /// </summary>
    public bool RadioButton3Setting
    {
        get
        {
            return GetValueOrDefault<bool>(RadioButton3SettingKeyName, RadioButton3SettingDefault);
        }
        set
        {
            AddOrUpdateValue(RadioButton3SettingKeyName, value);
            Save();
        }
    }

    /// <summary>
    /// Property to get and set a Username Setting Key.
    /// </summary>
    public string UsernameSetting
    {
        get
        {
            return GetValueOrDefault<string>(UsernameSettingKeyName, UsernameSettingDefault);
        }
        set
        {
            AddOrUpdateValue(UsernameSettingKeyName, value);
            Save();
        }
    }

    /// <summary>
    /// Property to get and set a Password Setting Key.
    /// </summary>
    public string PasswordSetting
    {
        get
        {
            return GetValueOrDefault<string>(PasswordSettingKeyName, PasswordSettingDefault);
        }
        set
        {
            AddOrUpdateValue(PasswordSettingKeyName, value);
            Save();
        }
    }


}

Everything is working fine and i am able to update the settings value from a xaml settings page and i can access the setting values in my main application using

 IsolatedStorageSettings Settings; 
 Settings = IsolatedStorageSettings.ApplicationSettings;
 string checkboxvalue = (string)Settings["CheckBoxSetting"];

Now what i want is to be able to know when a value in the application settings is changed/updated , so that i can perform a action when settings are updated .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:07:47+00:00Added an answer on June 3, 2026 at 7:07 am

    There are lots of ways you could do this but the easiest way to get startred is if you just query the settings when you need to know them.

    The other simple alternative woudl be for your AppSettings object to raise events when something was changed and have the relevant other classes subscribe to them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a Settings page for my app in Windows Phone
I am trying to create a settings page for an app, this app require
I am trying to create two different sets of settings for datepicker( http://keith-wood.name/datepick.html )
I am trying to create a folder in launcher application from the settings application.
I am trying to create a sort of 'settings' page, and I am having
I am trying to create a settings page(for the clients) where in they can
I am trying to create a settings table view for my app. I am
I am trying to create something to hold global site-wide settings in our ASP.NET
i'm trying to create following layout: http://jsfiddle.net/BTuMH/1/ but without setting the width, like: http://jsfiddle.net/yuGyg/
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.