/// <summary> /// Moves one endpoint of the range the specified number of units in the text. /// If the endpoint being moved crosses the other endpoint then the other endpoint /// is moved along too resulting in a degenerate range and ensuring the correct ordering /// of the endpoints. (i.e. always Start<=End) /// </summary> /// <param name="endpoint">The endpoint to move.</param> /// <param name="unit">The textual unit for moving.</param> /// <param name="count">The number of units to move. A positive count moves the endpoint forward. /// A negative count moves backward. A count of 0 has no effect.</param> /// <returns>The number of units actually moved, which can be less than the number requested if /// moving the endpoint runs into the beginning or end of the document.</returns> public int MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, int count) { ValidateEndpointArgument(endpoint, "endpoint"); ValidateUnitArgument(unit, "unit"); return(UiaCoreApi.TextRange_MoveEndpointByUnit(_hTextRange, endpoint, unit, count)); }