次の方法で共有


MenuActionEventArgs.Selection プロパティ

更新 : 2007 年 11 月

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

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

構文

'宣言
Public ReadOnly Property Selection As Selection
'使用
Dim instance As MenuActionEventArgs
Dim value As Selection

value = instance.Selection
public Selection Selection { get; }
public:
property Selection^ Selection {
    Selection^ get ();
}
public function get Selection () : Selection

プロパティ値

型 : Microsoft.Windows.Design.Interaction.Selection

現在選択されているコントロールを表す Selection

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

' 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(Control.BackgroundProperty).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[Control.BackgroundProperty].ClearValue();
}

アクセス許可

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

参照

参照

MenuActionEventArgs クラス

MenuActionEventArgs メンバ

Microsoft.Windows.Design.Interaction 名前空間

PrimarySelectionContextMenuProvider

MenuAction

MenuGroup

ModelItem

その他の技術情報

チュートリアル : MenuAction の作成