ITextRangeProvider.MoveEndpointByUnit Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Moves one endpoint of the text range the specified number of text units within the document range.
Namespace: System.Windows.Automation.Provider
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Function MoveEndpointByUnit ( _
endpoint As TextPatternRangeEndpoint, _
unit As TextUnit, _
count As Integer _
) As Integer
int MoveEndpointByUnit(
TextPatternRangeEndpoint endpoint,
TextUnit unit,
int count
)
Parameters
- endpoint
Type: System.Windows.Automation.Text.TextPatternRangeEndpoint
The endpoint to move.
- unit
Type: System.Windows.Automation.Text.TextUnit
The textual unit for moving.
- count
Type: System.Int32
The number of units to move.
A positive value moves the endpoint forward; a negative value moves the endpoint 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 moving the endpoint extends beyond the start or end of the document.
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:
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 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.
The resulting range is moved backward in the DocumentRange to the beginning of the requested unit boundary.
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, MoveEndpointByUnit defers to the next largest supported TextUnit.
The order, from the smallest text unit to the largest, is as follows:
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.