AutomationPeer.GetPatternCore(PatternInterface) Method
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.
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
- patternInterface
- PatternInterface
A value from the PatternInterface enumeration.
The object that implements the pattern interface; null if the peer does not support this interface.
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.
See the XAML accessibility sample (note that this sample is not maintained and might not compile) for an implementation of OnCreateAutomationPeer that defines the custom peer returned by OnCreateAutomationPeer (the peer implementation can be found in Scenario 3 of the sample).
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.
Product | Versions |
---|---|
Windows App SDK | 0.8, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 |