編集

次の方法で共有


Automation.AddAutomationEventHandler Method

Definition

Registers a method that handles UI Automation events.

public:
 static void AddAutomationEventHandler(System::Windows::Automation::AutomationEvent ^ eventId, System::Windows::Automation::AutomationElement ^ element, System::Windows::Automation::TreeScope scope, System::Windows::Automation::AutomationEventHandler ^ eventHandler);
public static void AddAutomationEventHandler (System.Windows.Automation.AutomationEvent eventId, System.Windows.Automation.AutomationElement element, System.Windows.Automation.TreeScope scope, System.Windows.Automation.AutomationEventHandler eventHandler);
static member AddAutomationEventHandler : System.Windows.Automation.AutomationEvent * System.Windows.Automation.AutomationElement * System.Windows.Automation.TreeScope * System.Windows.Automation.AutomationEventHandler -> unit
Public Shared Sub AddAutomationEventHandler (eventId As AutomationEvent, element As AutomationElement, scope As TreeScope, eventHandler As AutomationEventHandler)

Parameters

eventId
AutomationEvent

The identifier for the event the method will handle.

element
AutomationElement

The UI Automation element to associate with the event handler.

scope
TreeScope

The scope of events to be handled; that is, whether they are on the element itself, or on its ancestors and descendants.

eventHandler
AutomationEventHandler

The method to call when the specified event occurs.

Remarks

Some classes, such as GridPattern, expose fields identifying events that are specific to the class. The AddAutomationEventHandler method provides a mechanism that enables you to register handlers for these events.

eventHandler can be an instance of the method, or a reference to the method (AddressOf in Visual Basic).

Applies to

See also