App Settings

App settings are small, primitive values that are easy to store and retrieve. Using them looks much like using session state with SuspensionManager. However, these are typically used for settings that persist regardless of how the app exited. Furthermore, you have two options: local settings and roaming settings.

Local Settings

The following code shows how to do the three basic actions of reading/writing/deleting a local setting:

ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; // (1) Store a setting settings.Values["CurrentIndex"] = 5; // (2) Retrieve a setting object value = settings.Values["CurrentIndex"]; if (value != null) {   // The setting exists   int currentIndex ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.