SettingsPane class
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();
Attributes
- MarshalingBehaviorAttribute(None)
- MuseAttribute()
- StaticAttribute(Windows.UI.ApplicationSettings.ISettingsPaneStatics, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
Members
The SettingsPane class has these types of members:
Events
The SettingsPane class has these events.
| Event | Description |
|---|---|
| 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.
| Method | Description |
|---|---|
| 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.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets 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
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012
