Updated: December 2011
Registers a method that handles UI Automation events.
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 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).
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.