Compartir a través de


MenuAction.Execute (Evento)

Actualización: noviembre 2007

Se produce cuando se ejecuta el elemento de menú.

Espacio de nombres:  Microsoft.Windows.Design.Interaction
Ensamblado:  Microsoft.Windows.Design.Extensibility (en Microsoft.Windows.Design.Extensibility.dll)

Sintaxis

Public Event Execute As EventHandler(Of MenuActionEventArgs)

Dim instance As MenuAction
Dim handler As EventHandler(Of MenuActionEventArgs)

AddHandler instance.Execute, handler
public event EventHandler<MenuActionEventArgs> Execute
public:
 event EventHandler<MenuActionEventArgs^>^ Execute {
    void add (EventHandler<MenuActionEventArgs^>^ value);
    void remove (EventHandler<MenuActionEventArgs^>^ value);
}
JScript no admite eventos.

Comentarios

Implemente la lógica para MenuAction en el controlador de eventos Execute. Esto normalmente implica cambiar el estado de ModelItem que representa el control seleccionado.

Ejemplos

En el siguiente ejemplo de código se muestra cómo controlar el evento Execute. Establece la propiedad Background del control seleccionado en su valor predeterminado. Para obtener más información, consulte Tutorial: Crear 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();
}

Permisos

Vea también

Referencia

MenuAction (Clase)

MenuAction (Miembros)

Microsoft.Windows.Design.Interaction (Espacio de nombres)

PrimarySelectionContextMenuProvider

MenuGroup

ModelItem

Otros recursos

Tutorial: Crear MenuAction