UI Automation Events Overview
Microsoft UI Automation event notification is a key feature for assistive technologies such as screen readers and screen magnifiers. These UI Automation clients track events that are raised by UI Automation providers when something happens in the UI and use the information to notify end users.
Efficiency is improved by allowing provider applications to raise events selectively, depending on whether any clients are subscribed to those events, or not at all, if no clients are listening for any events.
This topic contains the following sections.
UI Automation events fall into the following categories.
Raised when a property on an UI Automation element or control pattern changes. For example, if a client needs to monitor an application's check box control, it can register to listen for a property change event on the ToggleState property. When the check box control is checked or unchecked, the provider raises the event and the client can act as necessary.
Raised when a change in the UI results from end user or programmatic activity; for example, when a button is clicked or invoked through InvokePattern.
Raised when the structure of the UI Automation tree changes. The structure changes when new UI items become visible, hidden, or removed on the desktop.
Global desktop change
Raised when actions of global interest to the client occur, such as when the focus shifts from one element to another, or when a window closes.
Some events do not necessarily mean that the state of the UI has changed. For example, if the user tabs to a text entry field and then clicks a button to update the field, a TextChangedEvent is raised even if the user did not actually change the text. When processing an event, it may be necessary for a client application to check whether anything has actually changed before taking action.
The following events may be raised even when the state of the UI has not changed.
AutomationPropertyChangedEvent (depending on the property that has changed)
The possible values for Id are given in the following table, along with the type used for event arguments. Note that the identifiers used by clients and providers are identically named fields from different classes.
Event Arguments Type
The following classes encapsulate event arguments.
Contains information about the asynchronous loading of content, including the percentage of loading completed.
Contains information about a simple event that requires no extra data.
Contains information about a change in input focus from one element to another. Events of this type are raised by the UI Automation system, not by providers.
Contains information about a change in a property value of an element or control pattern.
Contains information about a change in the UI Automation tree.
Contains information about a window closing.
The AutomationEvent objects used to identify events are obtained by providers from fields in AutomationElementIdentifiers and control pattern identifier classes such as DockPatternIdentifiers. The equivalent fields are obtained by client applications from fields in AutomationElement and control pattern classes such as DockPattern.
For a list of event identifiers, see UI Automation Events for Clients.