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)

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 UI Automation provider 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.

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

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

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top