Expand Minimize

AutomationPeer.GetPatternCore method

Applies to Windows and Windows Phone

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

Syntax


protected virtual object GetPatternCore(
  PatternInterface patternInterface
)

Parameters

patternInterface

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.

Remarks

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

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

See also

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

 

 

Show:
© 2014 Microsoft