Settings
Tip
This article covers Uno-specific information for managing user preferences. For a full description of the feature and instructions on using it, see Save and load settings in a UWP app.
- Settings API allows you to store the preferences of the user and preserve them across the launches of the application.
Supported features
Feature | Windows | Android | iOS | Web (WASM) | macOS | Linux (Skia) | Win 7 (Skia) |
---|---|---|---|---|---|---|---|
ApplicationData.Current.LocalSettings |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
ApplicationData.Current.RoamingSettings |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Using Settings with Uno
- On each target platform, the native user preferences APIs are used for storage.
RoamingSettings
are not roamed across devices, as this feature has been disabled by UWP/WinUI
Examples
Storing a Setting
ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values["MySettingName"] = "A user setting";
Reading a setting
ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
var localValue = localSettings.Values["MySettingName"] as string;