0

I am making a UWP app and I need to store some settings for my app in roaming AppData. I am using this code to save it:

public bool[] options =
    {
        true
    };

public bool[] saveCBState =
    {
        true,
        true,
        true
    };

ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;

// Some not important code...

roamingSettings.Values[nameof(options)] = options;

if (options[0])
    roamingSettings.Values[nameof(saveCBState)] = saveCBState;
else
    roamingSettings.Values[nameof(saveCBState)] = null;

Where can I find the settings that I just saved on my computer?

yesseruser
  • 68
  • 7
  • 1
    They're right where you put them: In `ApplicationData.Current.RoamingSettings`. Be aware that [these settings no longer roam](https://learn.microsoft.com/en-us/windows/uwp/get-started/settings-learning-track#what-do-you-need-to-know). – Raymond Chen Jan 30 '23 at 17:25
  • I want to know where are they stored ON THE COMPUTER, so I can maybe edit them externally. – yesseruser Feb 01 '23 at 14:54
  • The only supported way of accessing the values is to use the ApplicationData.Current.RoamingSettings API. The actual storage mechanism has changed over time. – Raymond Chen Feb 01 '23 at 15:42

1 Answers1

1

You could directly read the values form RoamingSettings whenever you want.

Like this:

         ApplicationDataContainer myroamingSettings = ApplicationData.Current.RoamingSettings;

        // load a setting that is local to the device
        var optionValue = myroamingSettings.Values[nameof(options)];
        var CBStateValue = myroamingSettings.Values[nameof(saveCBState)];

Also, please check the document that @Raymond Chen posted- https://learn.microsoft.com/en-us/windows/uwp/get-started/settings-learning-track#what-do-you-need-to-know, ApplicationData.Current.RoamingSettings gets the application settings container from the roaming app data store. Settings stored here no longer roam (as of Windows 11), but the settings store is still available.

Roy Li - MSFT
  • 8,043
  • 1
  • 7
  • 13