Proprietà MenuActionEventArgs.Selection

Ottiene la selezione corrente sull'area di progettazione.

Spazio dei nomi:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Sintassi

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

Valore proprietà

Tipo: Microsoft.Windows.Design.Interaction.Selection
Oggetto Selection che rappresenta il controllo attualmente selezionato.

Esempi

Nell'esempio di codice seguente viene illustrato come gestire l'evento Execute. La proprietà Background del controllo selezionato viene impostata sul valore predefinito. Per ulteriori informazioni, vedere Procedura dettagliata: creazione di un provider di menu.

' 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();
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

MenuActionEventArgs Classe

Spazio dei nomi Microsoft.Windows.Design.Interaction

PrimarySelectionContextMenuProvider

MenuAction

MenuGroup

ModelItem

Altre risorse

Procedura dettagliata: creazione di un provider di menu