/// <summary> /// Expands the range to an integral number of enclosing units. This could be used, for example, /// to guarantee that a range endpoint is not in the middle of a word. If the range is already an /// integral number of the specified units then it remains unchanged. /// For the TextUnit.Word unit with a degenerate range if the range is immediately before a word, /// inside that word, or within the whitespace following that word (but not immediately before the next /// word) then it will expand to include that word. /// For the TextUnit.Format unit if the range has mixed formatting then the range starting point will /// be moved backwards over any text that is identically formatted to that at the start of the range /// and the endpoint will be move forwards over any text that is identically formatted to that at the /// end of the range. /// </summary> /// <param name="unit">The textual unit.</param> public void ExpandToEnclosingUnit(TextUnit unit) { ValidateUnitArgument(unit, "unit"); UiaCoreApi.TextRange_ExpandToEnclosingUnit(_hTextRange, unit); }