Delen via


AutomationPeer.GetPatternCore(PatternInterface) Method

Definition

Provides the peer's behavior when a Microsoft UI Automation client calls GetPattern or an equivalent Microsoft UI Automation client API.

protected:
 virtual Platform::Object ^ GetPatternCore(PatternInterface patternInterface) = GetPatternCore;
IInspectable GetPatternCore(PatternInterface const& patternInterface);
protected virtual object GetPatternCore(PatternInterface patternInterface);
function getPatternCore(patternInterface)
Protected Overridable Function GetPatternCore (patternInterface As PatternInterface) As Object

Parameters

patternInterface
PatternInterface

A value from the PatternInterface enumeration.

Returns

Object

Platform::Object

IInspectable

The object that implements the pattern interface; null if the peer does not support this interface.

Remarks

The standard implementation at the AutomationPeer level returns null, because the basic peer class doesn't support any patterns. The majority of existing Windows Runtime peer classes override this method to report the patterns that a particular peer supports.

Overriding this method to return the implementation of patterns that your peer class supports is one of the most common scenarios for implementing an automation peer. See Custom automation peers.

Note

This sample is not maintained and might not compile.

See XAML accessibility sample for an implementation of OnCreateAutomationPeer that defines the custom peer returned by OnCreateAutomationPeer (the peer implementation is part of Scenario 3 in this sample).

Notes for previous versions

Windows 8.x

Windows 8 peer-selection behavior is potentially impacted by whether the control is intended to display data as items. The automation logic for Windows 8 might select a dedicated data peer and use its patterns, even if there is a peer indicated for the overall control and that peer overrides GetPatternCore. For example, you might have the ListViewAutomationPeer override for patterns, but in Windows 8 the acting patterns for data items might take precedence, for example the default implementation of ListViewItemDataAutomationPeer might be used and will handle the scrolling pattern when UI Automation looks for patterns in items. This is different starting with Windows 8.1; if there is pattern support indicated in a GetPatternCore implementation for the overall control, that implementation is used instead of internal item data peers.

If you migrate your app code from Windows 8 to Windows 8.1 you may want to account for this behavior change, because it means that your items control pattern support may be used for data items too, and you might have to add behavior for item scrolling, for instance.

Apps that were compiled for Windows 8 but running on Windows 8.1 continue to use the Windows 8 behavior.

Applies to

See also