Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Automation.AddAutomationEventHandler Method (AutomationEvent, AutomationElement, TreeScope, AutomationEventHandler)


Registers a method that handles UI Automation events.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public static void AddAutomationEventHandler(
	AutomationEvent eventId,
	AutomationElement element,
	TreeScope scope,
	AutomationEventHandler eventHandler


Type: System.Windows.Automation.AutomationEvent

The identifier for the event the method will handle.

Type: System.Windows.Automation.AutomationElement

The UI Automation element to associate with the event handler.

Type: System.Windows.Automation.TreeScope

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

Type: System.Windows.Automation.AutomationEventHandler

The method to call when the specified event occurs.

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).

.NET Framework
Available since 3.0
Return to top
© 2017 Microsoft