CacheRequest.Add Method (AutomationPattern)

 

Adds the specified AutomationPattern identifier to this CacheRequest.

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

public void Add(
	AutomationPattern pattern
)

Parameters

pattern
Type: System.Windows.Automation.AutomationPattern

An identifier specifying a pattern to cache.

Exception Condition
InvalidOperationException

The CacheRequest is active.

Adding a pattern that is already in the cache request has no effect.

The following example shows how to construct a CacheRequest and add a pattern to be cached.

CacheRequest cacheRequest = new CacheRequest();
cacheRequest.Add(AutomationElement.NameProperty);
cacheRequest.Add(AutomationElement.IsEnabledProperty);
cacheRequest.Add(SelectionItemPattern.Pattern);
cacheRequest.Add(SelectionItemPattern.SelectionContainerProperty);

.NET Framework
Available since 3.0
Return to top
Show: