SettingsPane クラス

定義

注意

SettingsPane は非推奨であり、Windows 10のすべてのバージョンでは機能しない場合があります。 SettingsPane を使用する代わりに、設定オプションをアプリ エクスペリエンスに統合します。 詳細については、「 アプリ設定のガイドライン」を参照してください。

アプリが [設定] チャーム ウィンドウを制御できるようにする静的クラス。 アプリは、コマンドを追加または削除したり、ユーザーがウィンドウを開いたときに通知を受け取ったり、プログラムでウィンドウを開いたりすることができます。

public ref class SettingsPane sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.UI.ApplicationSettings.ApplicationsSettingsContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("SettingsPane is deprecated and might not work on all platforms. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.UI.ApplicationSettings.ApplicationsSettingsContract)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
class SettingsPane final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.UI.ApplicationSettings.ApplicationsSettingsContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
/// [Windows.Foundation.Metadata.Deprecated("SettingsPane is deprecated and might not work on all platforms. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.UI.ApplicationSettings.ApplicationsSettingsContract")]
class SettingsPane final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.UI.ApplicationSettings.ApplicationsSettingsContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("SettingsPane is deprecated and might not work on all platforms. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.UI.ApplicationSettings.ApplicationsSettingsContract))]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
public sealed class SettingsPane
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.UI.ApplicationSettings.ApplicationsSettingsContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
[Windows.Foundation.Metadata.Deprecated("SettingsPane is deprecated and might not work on all platforms. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.UI.ApplicationSettings.ApplicationsSettingsContract")]
public sealed class SettingsPane
Public NotInheritable Class SettingsPane
継承
Object Platform::Object IInspectable SettingsPane
属性

Windows の要件

デバイス ファミリ
Windows Desktop Extension SDK (10.0.10240.0 で導入)
Xbox One Extensions for the UWP (10.0.10586.0 で導入)
API contract
Windows.UI.ApplicationSettings.ApplicationsSettingsContract (v1.0 で導入)

次のコードは、SettingsPane クラスと SettingsCommand クラスを使用してアプリ コマンドを追加する方法を示しています。 完全な例については、「 アプリ設定のサンプル」を参照してください。

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);
}
Imports Windows.UI.ApplicationSettings
Imports Windows.UI.Popups
Imports Windows.UI.Xaml
Imports Windows.UI.Xaml.Controls
Imports Windows.UI.Xaml.Navigation
Imports 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.
    Private Sub addSettingsScenarioAdd_Click(sender As Object, e As RoutedEventArgs)
        Dim b As Button = TryCast(sender, Button)
        If b IsNot Nothing Then
            rootPage.NotifyUser("You selected the " & b.Content & " button", _
                NotifyType.StatusMessage)
            If Not Me.isEventRegistered Then
                AddHandler SettingsPane.GetForCurrentView.CommandsRequested, _
                    AddressOf onCommandsRequested
                Me.isEventRegistered = True
            End If
        End If
    End Sub

    Private Sub onSettingsCommand(command As IUICommand)
        Dim settingsCommand As SettingsCommand = DirectCast(command, SettingsCommand)
        rootPage.NotifyUser( _
        "You selected the " & settingsCommand.Label & " command from the " & SettingsPane.Edge.ToString(), _
        NotifyType.StatusMessage)
    End Sub

    Private Sub onCommandsRequested(settingsPane As SettingsPane, _
        eventArgs As SettingsPaneCommandsRequestedEventArgs)
        Dim handler As New UICommandInvokedHandler(AddressOf onSettingsCommand)

        Dim generalCommand As New SettingsCommand("generalSettings", "General", handler)
        eventArgs.Request.ApplicationCommands.Add(generalCommand)

        Dim helpCommand As New SettingsCommand("helpPage", "Help", handler)
        eventArgs.Request.ApplicationCommands.Add(helpCommand)
    End Sub


    '' This is the click handler for the 'addSettingsScenarioShow' button.  
    '' Replace this with your own handler if you have a button or buttons on this page.
    Private Sub addSettingsScenarioShow_Click(sender As Object, e As RoutedEventArgs)
        Dim b As Button = TryCast(sender, Button)
        If b IsNot Nothing Then
            rootPage.NotifyUser("You selected the " & b.Content & " button", _
                NotifyType.StatusMessage)
            SettingsPane.Show()
        End If
    End Sub
#include "pch.h"
#include "AddSettingsScenario.xaml.h"

using namespace ApplicationSettings;

using namespace Windows::Foundation;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::UI::ApplicationSettings;
using namespace Windows::UI::Popups;

void ApplicationSettings::AddSettingsScenario::addSettingsScenarioAdd_Click(
    Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    Button^ b = safe_cast<Button^>(sender);
    if (b != nullptr)
    {
        rootPage->NotifyUser("You selected the " + b->Content + " button", 
            NotifyType::StatusMessage);
        if (!this->isEventRegistered)
        {
            this->commandsRequestedEventRegistrationToken = 
                SettingsPane::GetForCurrentView()->CommandsRequested += 
                    ref new TypedEventHandler<SettingsPane^, 
                    SettingsPaneCommandsRequestedEventArgs^>(this, 
                        &AddSettingsScenario::onCommandsRequested);
            this->isEventRegistered = true;
        }
    }
}

void ApplicationSettings::AddSettingsScenario::onSettingsCommand(
    Windows::UI::Popups::IUICommand^ command)
{
    SettingsCommand^ settingsCommand = safe_cast<SettingsCommand^>(command);
    rootPage->NotifyUser(
        "You selected the " + settingsCommand->Label + " settings command from the " + 
        SettingsPane::Edge.ToString(), NotifyType::StatusMessage);
}

void ApplicationSettings::AddSettingsScenario::onCommandsRequested(
    Windows::UI::ApplicationSettings::SettingsPane^ settingsPane,
    Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs^ eventArgs)
{
    UICommandInvokedHandler^ handler = ref new UICommandInvokedHandler(
        this, &AddSettingsScenario::onSettingsCommand);

    SettingsCommand^ generalCommand = ref new SettingsCommand(
        "generalSettings", "General", handler);
    eventArgs->Request->ApplicationCommands->Append(generalCommand);

    SettingsCommand^ helpCommand = ref new SettingsCommand("helpPage", "Help", handler);
    eventArgs->Request->ApplicationCommands->Append(helpCommand);
}

注釈

注意

このクラスはアジャイルではありません。つまり、スレッド モデルとマーシャリング動作を考慮する必要があります。 詳細については、「スレッド処理とマーシャリング (C++/CX)」および「マルチスレッド環境でのWindows ランタイム オブジェクトの使用 (.NET)」を参照してください。

プロパティ

Edge

注意

SettingsPane は非推奨であり、Windows 10のすべてのバージョンでは機能しない場合があります。 SettingsPane を使用する代わりに、設定オプションをアプリ エクスペリエンスに統合します。 詳細については、「 アプリ設定のガイドライン」を参照してください。

[設定] チャームが画面の左端または右端に表示されるかどうかを示す値を取得します。

メソッド

GetForCurrentView()

注意

SettingsPane は非推奨であり、Windows 10のすべてのバージョンでは機能しない場合があります。 SettingsPane を使用する代わりに、設定オプションをアプリ エクスペリエンスに統合します。 詳細については、「 アプリ設定のガイドライン」を参照してください。

現在のアプリ ビュー (つまり CoreWindow を使用) に関連付けられている SettingsPane オブジェクトを取得します。

Show()

注意

SettingsPane は非推奨であり、Windows 10のすべてのバージョンでは機能しない場合があります。 SettingsPane を使用する代わりに、設定オプションをアプリ エクスペリエンスに統合します。 詳細については、「 アプリ設定のガイドライン」を参照してください。

[設定] [チャーム] ウィンドウをユーザーに表示します。

イベント

CommandsRequested

注意

SettingsPane は非推奨であり、Windows 10のすべてのバージョンでは機能しない場合があります。 SettingsPane を使用する代わりに、設定オプションをアプリ エクスペリエンスに統合します。 詳細については、「 アプリ設定のガイドライン」を参照してください。

ユーザーが設定ウィンドウを開いたときに発生します。 このイベントをリッスンすると、アプリは設定コマンドを初期化し、ユーザーがウィンドウを閉じるまで UI を一時停止できます。

このイベントの間に、 SettingsCommand オブジェクトを使用可能な ApplicationCommands ベクターに追加して 、SettingsPaneUI で使用できるようにします。

適用対象

こちらもご覧ください