GetCachedPropertyValue Method (AutomationProperty, Boolean)

AutomationElement.GetCachedPropertyValue Method (AutomationProperty, Boolean)


Retrieves the value of the specified property from the cache of this AutomationElement, optionally ignoring any default property.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public object GetCachedPropertyValue(
	AutomationProperty property,
	bool ignoreDefaultValue


Type: System.Windows.Automation.AutomationProperty

The identifier of the property to retrieve.

Type: System.Boolean

A value that specifies whether a default value should be ignored if the specified property is not supported.

Return Value

Type: System.Object

An object containing the value of the specified property, or NotSupported if the element does not supply a value and ignoreDefaultValue is true.

Exception Condition

The requested property is not in the cache.


The UI for the AutomationElement no longer exists.

GetCachedPropertyValue retrieves the specified property from the cache for the AutomationElement. To retrieve the current property, call GetCurrentPropertyValue.

Passing false in ignoreDefaultValue is equivalent to calling AutomationElement.GetCachedPropertyValue(AutomationProperty).

If the for the element itself supports the property, the value of the property is returned. Otherwise, if ignoreDefaultValue is false, a default property specified by UI Automation is returned. For information on default properties, see the property identifier fields of AutomationElement, such as AcceleratorKeyProperty.GTMT

This method throws an exception if the requested property was not previously cached.

Legacy Code Example

The following example shows how this method can be used to retrieve a cached property.

Code snippet is not found. Confirm that the code snippet name 'UIAClient_snip' is correct.

.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft