Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

CacheRequest.Add Method

Definition

Namespace:
System.Windows.Automation
Assembly:
UIAutomationClient.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Adds a property or pattern identifier to a CacheRequest.

Overloads

Name Description
Add(AutomationPattern)

Adds the specified AutomationPattern identifier to this CacheRequest.

Add(AutomationProperty)

Adds the specified AutomationProperty identifier to this CacheRequest.

Remarks

When a CacheRequest object is created, the RuntimeIdProperty identifier is added as a default property to cache.

Adding an object that is already in the cache request has no effect.

Add(AutomationPattern)

Adds the specified AutomationPattern identifier to this CacheRequest.

public:
 void Add(System::Windows::Automation::AutomationPattern ^ pattern);
public void Add(System.Windows.Automation.AutomationPattern pattern);
member this.Add : System.Windows.Automation.AutomationPattern -> unit
Public Sub Add (pattern As AutomationPattern)

Parameters

pattern
AutomationPattern

An identifier specifying a pattern to cache.

Exceptions

Examples

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);
Dim myCacheRequest As New CacheRequest()
myCacheRequest.Add(AutomationElement.NameProperty)
myCacheRequest.Add(AutomationElement.IsEnabledProperty)
myCacheRequest.Add(SelectionItemPattern.Pattern)
myCacheRequest.Add(SelectionItemPattern.SelectionContainerProperty)

Remarks

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

See also

Applies to

Add(AutomationProperty)

Adds the specified AutomationProperty identifier to this CacheRequest.

public:
 void Add(System::Windows::Automation::AutomationProperty ^ property);
public void Add(System.Windows.Automation.AutomationProperty property);
member this.Add : System.Windows.Automation.AutomationProperty -> unit
Public Sub Add (property As AutomationProperty)

Parameters

property
AutomationProperty

An identifier specifying a property value to cache.

Exceptions

Examples

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

CacheRequest cacheRequest = new CacheRequest();
cacheRequest.Add(AutomationElement.NameProperty);
cacheRequest.Add(AutomationElement.IsEnabledProperty);
cacheRequest.Add(SelectionItemPattern.Pattern);
cacheRequest.Add(SelectionItemPattern.SelectionContainerProperty);
Dim myCacheRequest As New CacheRequest()
myCacheRequest.Add(AutomationElement.NameProperty)
myCacheRequest.Add(AutomationElement.IsEnabledProperty)
myCacheRequest.Add(SelectionItemPattern.Pattern)
myCacheRequest.Add(SelectionItemPattern.SelectionContainerProperty)

Remarks

When a CacheRequest is created, the RuntimeIdProperty identifier is added as a default property to cache.

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

See also

Applies to


Feedback

Was this page helpful?