AutomationElement.GetCachedPattern Method (AutomationPattern)


Retrieves the specified pattern from the cache of this AutomationElement.

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

member GetCachedPattern : 
        pattern:AutomationPattern -> Object


Type: System.Windows.Automation.AutomationPattern

The identifier of the pattern to retrieve.

Return Value

Type: System.Object

An object representing the specified pattern. If there are no matching patterns, null is returned.

Exception Condition

The requested pattern is not in the cache or is not supported by the element.


The UI for the AutomationElement no longer exists.

GetCachedPattern retrieves the specified pattern from the cache. To retrieve the current object for the specified pattern, call GetCurrentPattern.

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

The following example shows how to cache and retrieve a pattern.

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

.NET Framework
Available since 3.0
Return to top