Edytuj

Udostępnij za pośrednictwem


AutomationElementMode Enum

Definition

Contains values that specify the type of reference to use when returning UI Automation elements. These values are used in the AutomationElementMode property.

public enum class AutomationElementMode
public enum AutomationElementMode
type AutomationElementMode = 
Public Enum AutomationElementMode
Inheritance
AutomationElementMode

Fields

Name Value Description
None 0

Specifies that returned elements have no reference to the underlying UI and contain only cached information. This mode might be used, for example, to retrieve the names of items in a list box without obtaining references to the items themselves.

Full 1

Specifies that returned elements have a full reference to the underlying UI.

Examples

The following example shows how to set the mode on a CacheRequest.

// Set up the request.
CacheRequest cacheRequest = new CacheRequest();

// Do not get a full reference to the cached objects, only to their cached properties and patterns.
cacheRequest.AutomationElementMode = AutomationElementMode.None;
' Set up the request.
Dim cacheRequest As New CacheRequest()

' Do not get a full reference to the cached objects, only to their cached properties and patterns.
cacheRequest.AutomationElementMode = AutomationElementMode.None

Remarks

Full is the default, and specifies that returned elements contain a full reference to the underlying user interface (UI). None specifies that the returned elements have no reference to the underlying UI, and contain only cached information.

Certain operations on elements, such as GetCurrentPropertyValue or SetFocus, require a full reference; attempting to perform these on an element that has none results in an InvalidOperationException.

Using None can be more efficient when only properties are needed, as it avoids the overhead involved in setting up full references.

Applies to

See also