Поделиться через


Control patterns and interfaces

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

The table in this topic describes the Microsoft UI Automation control patterns. The table also lists the classes used by UI Automation clients to access the control patterns and the interfaces used by UI Automation providers to implement them. The Control pattern column shows the pattern name from the UI Automation client perspective, as a constant value listed in Control Pattern Availability Property Identifiers. From the UI Automation provider perspective, each of these patterns is a PatternInterface constant name. The Class provider interface column shows the name of the Windows Runtime interface that providers implement to provide this pattern for a custom XAML control.

For more info about how to implement custom automation peers that expose control patterns and implement the interfaces, see Custom automation peers.

When you implement a control pattern, you should also consult the UI Automation provider documentation that explains some of the expectations that clients will have of a control pattern regardless of which UI framework is used to implement it. Some of the info listed in the general UI Automation provider documentation will influence how you implement your peers and correctly support that pattern. See Implementing UI Automation Control Patterns, and view the page that documents the pattern you intend to implement.

Control pattern Class provider interface Description
Annotation IAnnotationProvider Used to expose the properties of an annotation in a document.
Dock IDockProvider Used for controls that can be docked in a docking container. For example, toolbars or tool palettes.
Drag IDragProvider Used to support draggable controls, or controls with draggable items.
DropTarget IDropTargetProvider Used to support controls that can be the target of a drag-and-drop operation.
ExpandCollapse IExpandCollapseProvider Used to support controls that visually expand to display more content and collapse to hide content.
Grid IGridProvider Used for controls that support grid functionality such as sizing and moving to a specified cell. Note that Grid itself does not implement this pattern in the Windows Runtime, because it provides layout but is not a control.
GridItem IGridItemProvider Used for controls that have cells within grids.
Invoke IInvokeProvider Used for controls that can be invoked, such as a Button.
ItemContainer IItemContainerProvider Enables applications to find an element in a container, such as a virtualized list.
MultipleView IMultipleViewProvider Used for controls that can switch between multiple representations of the same set of information, data, or children.
ObjectModel IObjectModelProvider Used to expose a pointer to the underlying object model of a document.
RangeValue IRangeValueProvider Used for controls that have a range of values that can be applied to the control. For example, a spinner control containing years might have a range of 1900 to the current year, while another spinner control presenting months would have a range of 1 to 12.
Scroll IScrollProvider Used for controls that can scroll. For example, a control that has scroll bars that are active when there is more information than can be displayed in the viewable area of the control.
ScrollItem IScrollItemProvider Used for controls that have individual items in a list that scrolls. For example, a list control that has individual items in the scroll list, such as a combo box control.
Selection ISelectionProvider Used for selection container controls. For example, ListBox and ComboBox.
SelectionItem ISelectionItemProvider Used for individual items in selection container controls, such as list boxes and combo boxes.
Spreadsheet ISpreadsheetProvider Used to expose the contents of a spreadsheet or other grid-based document.
SpreadsheetItem ISpreadsheetItemProvider Used to expose the properties of a cell in a spreadsheet or other grid-based document.
Styles IStylesProvider Used to describe a UI element that has a specific style, fill color, fill pattern, or shape.
SynchronizedInput ISynchronizedInputProvider Enables UI Automation client apps to direct the mouse or keyboard input to a specific UI element.
Table ITableProvider Used for controls that have a grid as well as header information. For example, a tabular calendar control.
TableItem ITableItemProvider Used for items in a table.
Text ITextProvider Used for edit controls and documents that expose textual information. See also ITextRangeProvider and ITextProvider2.
TextChild ITextChildProvider Used to access an element’s nearest ancestor that supports the Text control pattern.
TextEdit No managed class available Provides access to a control that modifies text, for example a control that performs auto-correction or enables input composition through an Input Method Editor (IME).
TextRange ITextRangeProvider Provides access to a span of continuous text in a text container that implements ITextProvider. See also ITextRangeProvider2.
Toggle IToggleProvider Used for controls where the state can be toggled. For example, CheckBox and menu items that can be checked.
Transform ITransformProvider Used for controls that can be resized, moved, and rotated. Typical uses for the Transform control pattern are in designers, forms, graphical editors, and drawing applications.
Value IValueProvider Allows clients to get or set a value on controls that do not support a range of values.
VirtualizedItem IVirtualizedItemProvider Exposes items inside containers that are virtualized and need to be made fully accessible as UI Automation elements.
Window IWindowProvider Exposes information specific to windows, a fundamental concept to the Microsoft Windows operating system. Examples of controls that are windows are child windows and dialogs.

 

Note  You won't necessarily find implementations of all these patterns in existing Windows Runtime XAML controls. Some of the patterns have interfaces in the Windows Runtime solely to support parity with the general UI Automation framework definition of patterns, and to support automation peer scenarios that will require a purely custom implementation to support that pattern.

 

Note  Some the patterns listed here are supported starting with Windows 8.1. Check the Requirements sections in the interface reference pages to see if that interface is available in Windows 8.

Note  Windows Phone Store apps do not support all the UI Automation control patterns listed here. Annotation, Dock, Drag, DropTarget, ObjectModel are some of the unsupported patterns.

Custom automation peers

Accessibility for Windows Runtime apps using C#/VB/C++ and XAML