MenuActionEventArgs.Selection プロパティ

デザイン サーフェイス上の現在の選択内容を取得します。

名前空間:  Microsoft.Windows.Design.Interaction
アセンブリ:  Microsoft.Windows.Design.Interaction (Microsoft.Windows.Design.Interaction.dll 内)

構文

'宣言
Public ReadOnly Property Selection As Selection
    Get
public Selection Selection { get; }
public:
property Selection^ Selection {
    Selection^ get ();
}
member Selection : Selection
function get Selection () : Selection

プロパティ値

型: Microsoft.Windows.Design.Interaction.Selection
現在選択されているコントロールを表す Selection

Execute イベントを処理する方法を次のコード例に示します。 ここでは、選択されたコントロールの Background プロパティを既定値に設定しています。 詳細については、「チュートリアル: メニュー プロバイダーの作成」を参照してください。

' The following method handles the Execute event. 
' It sets the Background property to its default value.
Sub ClearBackground_Execute( _
    ByVal sender As Object, _
    ByVal e As MenuActionEventArgs)

    Dim selectedControl As ModelItem = e.Selection.PrimarySelection
    selectedControl.Properties("Background").ClearValue()

End Sub
// The following method handles the Execute event. 
// It sets the Background property to its default value.
void ClearBackground_Execute(
    object sender, 
    MenuActionEventArgs e)
{
    ModelItem selectedControl = e.Selection.PrimarySelection;
    selectedControl.Properties["Background"].ClearValue();
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

MenuActionEventArgs クラス

Microsoft.Windows.Design.Interaction 名前空間

PrimarySelectionContextMenuProvider

MenuAction

MenuGroup

ModelItem

その他の技術情報

チュートリアル: メニュー プロバイダーの作成