ISelectionProvider2 interface

Extends the ISelectionItemProvider interface to provide information about selected items.


The ISelectionProvider2 interface has these methods.

Method Description
ISelectionProvider2::get_CurrentSelectedItem Gets the currently selected item.
ISelectionProvider2::get_FirstSelectedItem Gets the first item in a group of selected items.
ISelectionProvider2::get_ItemCount Gets the number of selected items.
ISelectionProvider2::get_LastSelectedItem Gets the last item in a group of selected items.


This interface is implemented by a Microsoft UI Automation provider.

Providers should raise an event of type UIA_Selection_InvalidatedEventId when a selection in a container has changed significantly.

When selecting from a list or 2D grid there are primary pieces of information that ATs would like to better read to their end users. Using Excel as a primary example, there are 4 main pieces of information necessary for the AT to provide a good experience:

  • The first cell in the selection
  • The last cell in the selection
  • The current item as you select
  • The total count
Image of an Excel spreadsheet showing multiple cells selected. Selection starts in the upper right on cell F5 and ends in the lower left on cell D7. The above image illustrates the end state of a 2D selection:
  • The user started in cell F5 (note this is where focus input stays because if you type that is where data lands)
  • The user selects down the column to cell F7
  • The user then selects left to cell D7


Minimum supported client Windows 10, version 1709 [desktop apps | UWP apps]
Minimum supported server Windows Server 2016 [desktop apps | UWP apps]
Target Platform Windows
Header uiautomationcore.h (include UIAutomation.h)

See Also


UI Automation Providers Overview