ITextRangeProvider.Move Method

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

Moves the text range the specified number of text units.

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

Syntax

'Declaration
Function Move ( _
    unit As TextUnit, _
    count As Integer _
) As Integer
int Move(
    TextUnit unit,
    int count
)

Parameters

  • count
    Type: System.Int32
    The number of text units to move.
    A positive value moves the text range forward; a negative value moves the text range backward; and a value of 0 has no effect.

Return Value

Type: System.Int32
The number of units actually moved. This value can be less than the count requested if either of the new text range endpoints is greater than or less than the DocumentRange endpoints.

Remarks

To traverse the content of a text range, the following steps are performed by the API behavior in order for the Move method to execute successfully:

  1. The text range is normalized; that is, the text range is collapsed to a degenerate range at the Start endpoint, which makes the End endpoint unnecessary. This step is performed to remove ambiguity in situations where a text range spans unit boundaries; for example, "{The U}RL https://www.microsoft.com is embedded in text" where "{" and "}" are the text range endpoints.

  2. The resulting range is moved backward in the DocumentRange to the start of the requested unit boundary.

  3. The range is moved forward or backward in the DocumentRange by the requested number of unit boundaries.

  4. The range is then expanded from a degenerate range state by moving the End endpoint by one requested unit boundary.

 

If the given TextUnit is not supported by the control, Move defers to the next largest supported TextUnit.

The order, from the smallest text unit to the largest, is as follows:

The text is not changed in any way; the text range just spans a different part of the text.

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.