Evento MenuAction.Execute

Ocorre quando o item de menu é executado.

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

Sintaxe

'Declaração
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>
O JScript não oferece suporte a eventos.

Comentários

Implementar a lógica para seu MenuAction na Execute manipulador de eventos. Isso normalmente envolve alterando o estado da ModelItem que representa o controle selecionado.

Exemplos

O exemplo de código a seguir mostra como lidar com o Execute de evento. Ele define o controle selecionado Background propriedade para o valor padrão. For more information, see Passo a passo: Criando um provedor de 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();
}

Segurança do .NET Framework

Consulte também

Referência

MenuAction Classe

Namespace Microsoft.Windows.Design.Interaction

PrimarySelectionContextMenuProvider

MenuGroup

ModelItem

Outros recursos

Passo a passo: Criando um provedor de menu