Quickstart: Adding app settings using Windows Runtime

This quickstart walks you through implementing the Settings contract using Windows Runtime classes. However, we recommend you should instead follow the steps in the Quickstart: Adding app settings using Windows Library for JavaScript. If you're creating an app using C++/C#/VB and XAML, check out this Quickstart: Add app settings instead.

Prerequisites

Read the Guidelines for app settings.

1. Specify the commands to be exposed in Settings

  1. Listen for the settings pane's CommandsRequested event.

  2. Specify the commands in the associated callback. For each command:

    1. Provide a SettingsCommand.Id and a localized SettingsCommand.Label.
    2. Set the handler (SettingsCommand.Invoked) for the event that will be fired when the user selects the command.
    3. Append the SettingsCommand object to the ApplicationCommands vector to make it available to the SettingsPane.

2. Show the appropriate custom settings when user asks for them

  • Show the appropriate app-defined settings UI in response to the user invocation of a settings command.
  • Keep the UI for this simple, and dismissible with a touch, to keep the user in the current app context.
  • Reflect settings changes in the app instantly.
  • Show the settings UI on the same side as the charms appear by checking the SettingsEdgeLocation property.

Summary

In this quickstart, you learned the two high-level steps in setting up the Settings contract using Windows Runtime classes.

Samples

Application settings sample

Reference

Windows.UI.ApplicationSettings

Docs

Quickstart: Using Windows Library for JavaScript

Guidelines for app settings