ITextProvider.GetSelection Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

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

Retrieves a collection of disjoint text ranges that are associated with the current text selection or selections.

Namespace:  System.Windows.Automation.Provider
Assembly:  System.Windows (in System.Windows.dll)

Syntax

Function GetSelection As ITextRangeProvider()
ITextRangeProvider[] GetSelection()

Return Value

Type: array<System.Windows.Automation.Provider..::.ITextRangeProvider>[]()[]
A collection of disjoint text ranges.

Exceptions

Exception Condition
InvalidOperationException

If the UI Automation provider does not support text selection.

Remarks

For UI Automation providers that support text selection, the provider should implement this method and also return a SupportedTextSelection value.

If no text is selected, GetSelection returns the degenerate text range (empty range) at the position of the system cursor (the text insertion point).

If the system cursor is not present, GetSelection may return nullNothingnullptra null reference (Nothing in Visual Basic).

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Platforms

Windows Phone

See Also

Reference

ITextProvider Interface

System.Windows.Automation.Provider Namespace

ITextRangeProvider