GetCachedPropertyValue Method (AutomationProperty)

AutomationElement.GetCachedPropertyValue Method (AutomationProperty)


Retrieves the value of the specified property from the cache of this AutomationElement. An appropriate default value for the property type is returned for properties not explicitly supported by the target user interface (UI) element.

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

public object GetCachedPropertyValue(
	AutomationProperty property


Type: System.Windows.Automation.AutomationProperty

The identifier of the property to retrieve.

Return Value

Type: System.Object

An object containing the value of the specified property.

Exception Condition

The requested property is not in the cache.


The user interface (UI) for the AutomationElement no longer exists.

If the for the element itself supports the property, the value of the property is returned. Otherwise, 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

GetCachedPropertyValue retrieves the specified property from the AutomationElement's cache. To retrieve the current object for the specified property call GetCurrentPropertyValue.

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

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

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