Using WPF objects, methods, and properties

When accessing the internal properties and methods of WPF objects, it is important to know which property to use to access the object that contains the information you want to set or retrieve.

AutomationElement property

UI Automation exposes every element in the UI as an Automation Element. Automation Elements expose common properties of the UI elements they represent.

For example, a button control has the Automation Element property NameProperty, which references the name or text associated with a button control. That same property is called caption or alt in Win32 and HTML, respectively. With UI Automation, all button controls have a NameProperty, which is mapped to the corresponding property in each framework.

The Automation Element also exposes control patterns that provide properties and expose methods specific to their control types.

This property

AutomationPattern property

Returns the object that gives access to the specific instance of a Control Pattern.

Control patterns represent discrete pieces of functionality that a control in the UI can perform. The total set of control patterns for a control type define the functionality of that control type.

Control patterns expose methods that provide the ability to programmatically manipulate the control. Control patterns also expose properties that provide information on the control's functionality and current state.

The set of supported control patterns for a particular control can be dynamically defined. Therefore, a particular control type may not always support the same set of control patterns. For example, a multiline edit box supports scrolling (scrollpattern pattern) only if its text exceeds the viewable area.

Some controls types, such as Image controls do not support any control patterns.

UFT enables you to access the methods and properties of automation elements and control patterns using special properties in the UFT object model for WPF.

For details on the methods and properties that are accessible through the AutomationPattern property, see the .NET Framework Developer Center of the Microsoft Developer Network library.

Object property Returns the object that gives access to properties specific to the actual run-time UI object, as defined by the developer.

Many of the properties and methods accessible through the AutomationElement and AutomationPattern properties contain the same information as the properties and methods accessible through the Object property. However, information available through UI Automation that is accessed through the Object property lacks the standardization provided by UI Automation.

Custom properties designed by the developer are accessible only through the Object property.