ITextProvider.GetSelection Method

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)

ITextRangeProvider[] GetSelection()

Return Value

Type: System.Windows.Automation.Provider.ITextRangeProvider[]
A collection of disjoint text ranges.


If the UI Automation provider does not support text selection.

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 null.


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions