Windows Dev Center

Expand Minimize

AutomationPeer.GetPatternCore method

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


Protected Overridable Function GetPatternCore(
  patternInterface As PatternInterface 
) As Object



Type: PatternInterface

A value from the PatternInterface enumeration.

Return value

Type: System.Object [.NET] | Platform::Object [C++]

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


The "Core" methods are the standard implementations that perform the default action of an associated UI Automation client-callable method. You can override any of the "Core" methods to return alternative values in a custom automation peer. In this case, GetPatternCore is invoked any time that GetPattern is called.

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. You can see sample code for this in the XAML accessibility sample (Scenario 3). You should also read the Custom automation peers topic.

Windows 8 behavior

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.

Requirements (Windows 10 device family)

Device family


API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml::Automation::Peers [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Automation::Peers [C++]



See also

Custom automation peers
Control patterns and interfaces
Accessibility for Windows Store apps using C#/VB/C++ and XAML
XAML accessibility sample



© 2015 Microsoft