Windows Dev Center

SettingsPane class

[SettingsPane may be altered or unavailable for releases after Windows 10. Instead of using a SettingsPane, integrate settings options into the app experience. For more info, see Guidelines for app settings.]

A static class that enables the app to control the Settings Charm pane. The app can add or remove commands, receive a notification when the user opens the pane, or open the pane programmatically.

Syntax


var settingsPane = Windows.UI.ApplicationSettings.SettingsPane.getForCurrentView();

Members

The SettingsPane class has these types of members:

Events

The SettingsPane class has these events.

EventDescription
CommandsRequested Occurs when the user opens the settings pane. Listening for this event lets the app initialize the setting commands and pause its UI until the user closes the pane.

 

Methods

The SettingsPane class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
GetForCurrentView Gets a SettingsPane object that is associated with the current app view (that is, with CoreWindow).
Show Displays the Settings Charm pane to the user.

 

Properties

The SettingsPane class has these properties.

PropertyAccess typeDescription

Edge

Read-onlyGets a value indicating whether the Settings charm appears on the left or right edge of the screen.

 

Remarks

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Examples

The following code shows how to add app commands by using the SettingsPane and SettingsCommand classes. For the full example, see App settings sample.


using Windows.UI.ApplicationSettings;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System;

// This is the click handler for the 'addSettingsScenarioAdd' button.  
// Replace this with your own handler if you have a button or buttons on this page.
void addSettingsScenarioAdd_Click(object sender, RoutedEventArgs e)
{
    Button b = sender as Button;
    if (b != null)
    {
        rootPage.NotifyUser(
            "You selected the " + b.Content + " button", 
            NotifyType.StatusMessage);

        if (!this.isEventRegistered)
        {
            SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested;
            this.isEventRegistered = true;
        }
    }
}

void onSettingsCommand(IUICommand command)
{
    SettingsCommand settingsCommand = (SettingsCommand)command;
    rootPage.NotifyUser(
        "You selected the " + settingsCommand.Label + " settings command from the " + 
        SettingsPane.Edge.ToString(), NotifyType.StatusMessage);

}

void onCommandsRequested(
    SettingsPane settingsPane, 
    SettingsPaneCommandsRequestedEventArgs eventArgs)
{
    UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand);

    SettingsCommand generalCommand = new SettingsCommand(
        "generalSettings", "General", handler);
    eventArgs.Request.ApplicationCommands.Add(generalCommand);

    SettingsCommand helpCommand = new SettingsCommand("helpPage", "Help", handler);
    eventArgs.Request.ApplicationCommands.Add(helpCommand);
}

Requirements (Windows 10 device family)

Device family

Desktop

API contract

Windows.UI.ApplicationSettings.ApplicationsSettingsContract, introduced version 1.0

Namespace

Windows.UI.ApplicationSettings
Windows::UI::ApplicationSettings [C++]

Metadata

Windows.UI.ApplicationSettings.ApplicationsSettingsContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

End of client support

Windows 10

End of phone support

Windows 10 Mobile

End of server support

Windows Server Technical Preview

Namespace

Windows.UI.ApplicationSettings
Windows::UI::ApplicationSettings [C++]

Metadata

Windows.winmd

Attributes

[Deprecated()]
[MarshalingBehavior(None)]
[Muse()]
[Version(0x06020000)]

See also

Object
SettingsCommand
App settings sample

 

 

Show:
© 2015 Microsoft