ISelectionProvider.GetSelection 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.
Retrieves a UI Automation provider for each child element that is selected.
public:
cli::array <System::Windows::Automation::Provider::IRawElementProviderSimple ^> ^ GetSelection();
public System.Windows.Automation.Provider.IRawElementProviderSimple[] GetSelection();
abstract member GetSelection : unit -> System.Windows.Automation.Provider.IRawElementProviderSimple[]
Public Function GetSelection () As IRawElementProviderSimple()
A collection of UI Automation providers.
The following example shows one possible implementation of this method for a list box that supports only single selection.
/// <summary>
/// Returns the UI Automation provider for the selected list items.
/// </summary>
/// <returns>The selected items.</returns>
/// <remarks>
/// Because this is a single-selection list box, only one item is
/// returned.
/// </remarks>
IRawElementProviderSimple[] ISelectionProvider.GetSelection()
{
int index = OwnerListControl.SelectedIndex;
return new IRawElementProviderSimple[] { GetProviderForIndex(index) };
}
''' <summary>
''' Returns the UI Automation provider for the selected list items.
''' </summary>
''' <returns>The selected items.</returns>
''' <remarks>
''' Because this is a single-selection list box, only one item is
''' returned.
''' </remarks>
Private Function GetSelection() As IRawElementProviderSimple() Implements ISelectionProvider.GetSelection
Dim index As Integer = OwnerListControl.SelectedIndex
Return New IRawElementProviderSimple() { GetProviderForIndex(index) }
End Function
A default empty array is returned by UIAutoCore.dll when the provider doesn't supply a value.
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: