Freigeben über


AutomationInteropProvider.RaiseAutomationEvent Methode

Definition

Löst ein Musterereignis oder ein benutzerdefiniertes Ereignis aus.

public:
 static void RaiseAutomationEvent(System::Windows::Automation::AutomationEvent ^ eventId, System::Windows::Automation::Provider::IRawElementProviderSimple ^ provider, System::Windows::Automation::AutomationEventArgs ^ e);
public static void RaiseAutomationEvent (System.Windows.Automation.AutomationEvent eventId, System.Windows.Automation.Provider.IRawElementProviderSimple provider, System.Windows.Automation.AutomationEventArgs e);
static member RaiseAutomationEvent : System.Windows.Automation.AutomationEvent * System.Windows.Automation.Provider.IRawElementProviderSimple * System.Windows.Automation.AutomationEventArgs -> unit
Public Shared Sub RaiseAutomationEvent (eventId As AutomationEvent, provider As IRawElementProviderSimple, e As AutomationEventArgs)

Parameter

eventId
AutomationEvent

Der Ereignisbezeichner.

provider
IRawElementProviderSimple

Das dem Ereignis zugeordnete Element.

e
AutomationEventArgs

Informationen zum Ereignis.

Beispiele

/// <summary>
/// Raises an event when a control is invoked.
/// </summary>
/// <param name="provider">The UI Automation provider for the control.</param>
private void RaiseInvokeEvent(IRawElementProviderSimple provider)
{
    if (AutomationInteropProvider.ClientsAreListening)
    {
        AutomationEventArgs args = 
            new AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent);
        AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent, 
            provider, args);
    }
}
''' <summary>
''' Raises an event when a control is invoked.
''' </summary>
''' <param name="provider">The UI Automation provider for the control.</param>
Private Sub RaiseInvokeEvent(ByVal provider As IRawElementProviderSimple)
    If AutomationInteropProvider.ClientsAreListening Then
        Dim args As New AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent)
        AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent, provider, args)
    End If

End Sub

Hinweise

Musterereignisse sollten nicht nur durch eine Musterimplementierung ausgelöst werden. Beispielsweise sollte eine InvokedEvent ausgelöst werden, wenn das Steuerelement aufgerufen wird, entweder über oder über Invoke Maus- oder Tastatureingaben. Auf diese Weise können Clients über Systemereignisse informiert werden.

Gilt für:

Weitere Informationen