Implementing the UI Automation SelectionItem Control Pattern

System_CAPS_ICON_note.jpg Note

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 ISelectionItemProvider, including information about properties, methods, and events. Links to additional references are listed at the end of the overview.

The SelectionItemPattern control pattern is used to support controls that act as individual, selectable child items of container controls that implement ISelectionProvider. For examples of controls that implement the SelectionItem control pattern, see Control Pattern Mapping for UI Automation Clients

When implementing the Selection Item control pattern, note the following guidelines and conventions:

The following properties, methods, and events are required for implementing ISelectionItemProvider.

Required membersMember typeNotes
InvalidatedEventEventRaised when a selection in a container has changed significantly and requires sending more ElementSelectedEvent and ElementRemovedFromSelectionEvent events than the InvalidateLimit constant permits.

Providers must throw the following exceptions.

Exception typeCondition
InvalidOperationExceptionWhen any of the following are attempted:

- RemoveFromSelection is called on a single-selection container where IsSelectionRequiredProperty = true and an element is already selected.
- RemoveFromSelection is called on a multiple-selection container where IsSelectionRequiredProperty = true and only one element is selected.
- AddToSelection is called on a single-selection container where CanSelectMultipleProperty = false and another element is already selected.

UI Automation Control Patterns Overview
Support Control Patterns in a UI Automation Provider
UI Automation Control Patterns for Clients
Implementing the UI Automation Selection Control Pattern
UI Automation Tree Overview
Use Caching in UI Automation
Fragment Provider Sample