次の方法で共有


ITextProvider.GetSelection Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

'Declaration
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 nulla null reference (Nothing in Visual Basic).

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

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