CachedChildren Property

AutomationElement.CachedChildren Property


Gets the cached child elements of this AutomationElement.

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

public AutomationElementCollection CachedChildren { get; }

Property Value

Type: System.Windows.Automation.AutomationElementCollection

The collection of child elements. This collection can be empty if the element has no children.

Exception Condition

The UI for the AutomationElement no longer exists.


No request was made to cache the children of this element.

The view of the returned collection is determined by the TreeFilter condition of the CacheRequest that was active when this AutomationElement object was obtained.

Children are cached only if the scope of the CacheRequest included Subtree, Children, or Descendants.

If the CacheRequest specified that children were to be cached at this level, but there are no children, then the value of this property is 0. However, if no request was made to cache children at this level, an attempt to retrieve the property raises an exception.

In the following example, a list box element is obtained from the parent window element while a CacheRequest is active and TreeScope is Children. The specified properties of the child elements (that is, the list items) are stored in the cache and can be retrieved from the CachedChildren of the list box.

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