UI Automation Properties Overview
Note
This documentation is intended for .NET Framework developers who want to use the managed UI Automation classes defined in the System.Windows.Automation namespace. For the latest information about UI Automation, see Windows Automation API: UI Automation.
UI Automation providers expose properties on Microsoft UI Automation elements. These properties enable UI Automation client applications to discover information about pieces of the user interface (UI), especially controls, including both static and dynamic data.
This topic contains the following sections.
- Property Identifiers
- Properties by Category
- Localization
- Properties and Events
- Related Topics
This section gives a broad overview of Microsoft UI Automation properties. More specific information is given in the following topics:
Property Identifiers
Every property is identified by a number and a name. The names of properties are used only for debugging and diagnosis. Providers use the numeric IDs to identify incoming property requests. Client applications, however, only use AutomationProperty, which encapsulates the number and name, to identify properties they wish to retrieve.
AutomationProperty objects representing particular properties are available as fields in various classes. For security reasons, UI Automation providers obtain these objects from a separate set of classes that are contained in Uiautomationtypes.dll.
The following table categorizes properties by the classes that contain the AutomationProperty IDs.
Kinds of properties |
Clients get IDs from |
Providers get IDs from |
---|---|---|
Properties common to all elements (see following tables) |
||
Position of a docking window |
||
State of an element that can expand and collapse |
||
Properties of an item in a grid |
||
Properties of a grid |
||
Current and supported view of an element that has multiple views |
||
Properties of an element that moves over a range of values, such as a slider |
||
Properties of a scrolling window |
||
Status and container of an item that can be selected, as in a list |
||
Properties of a control that contains selection items |
||
Column and row headers of an item in a table |
||
Column and row headers, and orientation, of a table |
||
State of a toggle control |
||
Capabilities of an element that can be moved, rotated, or resized |
||
Value and read/write capabilities of an element that has a value |
||
Capabilities and state of a window |
Properties by Category
The following tables categorize the properties whose IDs are found in AutomationElement and AutomationElementIdentifiers. These properties are common to all controls. All but a few of them are likely to be static over the lifetime of the provider application; most dynamic properties are associated with control patterns.
The Property Access column lists any other accessors for each property, in addition to GetCurrentPropertyValue and GetCachedPropertyValue. For more information on getting properties in a client application, see UI Automation Properties for Clients.
Note
For specific information about each property, follow the link in the Property Access column.
Display Characteristics
Property identifier |
Property access |
---|---|
n/a |
|
Element Type
Property identifier |
Property access |
---|---|
Identification
Property identifier |
Property access |
---|---|
Interaction
Property identifier |
Property access |
---|---|
Support for Patterns
Property identifier |
Property access |
---|---|
Miscellaneous
Property identifier |
Property access |
---|---|
Localization
UI Automation providers should present the following properties in the language of the operating system:
Properties and Events
Closely tied in with the properties in UI Automation is the concept of property-changed events. For dynamic properties, the client application needs a way to know that a property value has changed, so that it can update its cache of information or react to the new information in some other way.
Providers raise events when something in the UI changes. For example, if a check box is selected or cleared, a property-changed event is raised by the provider's implementation of the Toggle pattern. Providers can raise events selectively, depending on whether any clients are listening for events, or listening for specific events.
Not all property changes raise events; that is entirely up to the implementation of the UI Automation provider for the element. For example, the standard proxy providers for list boxes do not raise an event when the SelectionProperty changes. In this case, the application instead must listen for an ElementSelectedEvent.
Clients listen for events by subscribing to them. Subscribing to events means creating delegate methods that can handle the events, and then passing the methods to UI Automation along with the specific events that will be dealt with in those methods. For property-changed events in particular, clients must implement AutomationPropertyChangedEventHandler.
See Also
Tasks
Find a UI Automation Element Based on a Property Condition
Return Properties from a UI Automation Provider
Raise Events from a UI Automation Provider
Concepts
Caching in UI Automation Clients