MenuActionEventArgs.Selection-Eigenschaft

Ruft die aktuelle Auswahl auf der Entwurfsoberfläche ab.

Namespace:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

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

Eigenschaftswert

Typ: Microsoft.Windows.Design.Interaction.Selection
Eine Selection, die das aktuell ausgewählte Steuerelement darstellt.

Beispiele

Im folgenden Codebeispiel wird das Behandeln des Execute-Ereignisses veranschaulicht. Es legt die Background-Eigenschaft des ausgewählten Steuerelements auf seinen Standardwert fest. Weitere Informationen finden Sie unter Exemplarische Vorgehensweise: Erstellen eines Menüanbieters.

' 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-Sicherheit

Siehe auch

Referenz

MenuActionEventArgs Klasse

Microsoft.Windows.Design.Interaction-Namespace

PrimarySelectionContextMenuProvider

MenuAction

MenuGroup

ModelItem

Weitere Ressourcen

Exemplarische Vorgehensweise: Erstellen eines Menüanbieters