MenuAction.Execute (Evento)
Se produce cuando se ejecuta el elemento de menú.
Espacio de nombres: Microsoft.Windows.Design.Interaction
Ensamblado: Microsoft.Windows.Design.Interaction (en Microsoft.Windows.Design.Interaction.dll)
Sintaxis
'Declaración
Public Event Execute As EventHandler(Of MenuActionEventArgs)
public event EventHandler<MenuActionEventArgs> Execute
public:
event EventHandler<MenuActionEventArgs^>^ Execute {
void add (EventHandler<MenuActionEventArgs^>^ value);
void remove (EventHandler<MenuActionEventArgs^>^ value);
}
member Execute : IEvent<EventHandler<MenuActionEventArgs>,
MenuActionEventArgs>
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, vea Tutorial: Crear un proveedor de menús.
' 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();
}
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.
Vea también
Referencia
Microsoft.Windows.Design.Interaction (Espacio de nombres)
PrimarySelectionContextMenuProvider