Implementing the UI Automation Selection Control Pattern
This documentation is intended for .NET Framework developers who want to use the managed UI Automation classes defined in the System.Windows.Automation namespace. For the latest information about UI Automation, see Windows Automation API: UI Automation.
This topic introduces guidelines and conventions for implementing ISelectionProvider, including information about events and properties. Links to additional references are listed at the end of the topic.
The SelectionPattern control pattern is used to support controls that act as containers for a collection of selectable child items. The children of this element must implement ISelectionItemProvider. For examples of controls that implement this control pattern, see Control Pattern Mapping for UI Automation Clients.
When implementing the Selection control pattern, note the following guidelines and conventions:
Controls that implement ISelectionProvider allow either single or multiple child items to be selected. For example, list box, list view, and tree view support multiple selections whereas combo box, slider, and radio button group support single selection.
Single-selection controls that manage child controls that implement IRawElementProviderFragmentRoot, such as the Screen Resolution slider in the Display Properties dialog box or the Color Picker selection control from Microsoft Word (illustrated below), should implement ISelectionProvider; their children should implement both IRawElementProviderFragment and ISelectionItemProvider.
The following properties, methods, and events are required for the ISelectionProvider interface.
Raised when a selection in a container has changed significantly and requires sending more addition and removal events than the InvalidateLimit constant permits.
The IsSelectionRequired and CanSelectMultiple properties can be dynamic. For example, the initial state of a control might not have any items selected by default, indicating that IsSelectionRequired is false. However, after an item is selected, the control must always have at least one item selected. Similarly, in rare cases, a control might allow multiple items to be selected on initialization, but subsequently allow only single selections to be made.