Export (0) Print
Expand All

Automation.AddAutomationEventHandler Method

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
)

Parameters

eventId
Type: System.Windows.Automation.AutomationEvent

The identifier for the event the method will handle.

element
Type: System.Windows.Automation.AutomationElement

The UI Automation element to associate with the event handler.

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

eventHandler
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

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft