ITextSelection ITextSelection ITextSelection ITextSelection Interface

Definition

Represents the currently selected text of a document.

public : interface ITextSelectionpublic interface ITextSelectionPublic Interface ITextSelection// This API is not available in Javascript.
Inheritance
ITextSelectionITextSelectionITextSelectionITextSelection
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Windows.UI.Text.ITextRange.GetCharacterUtf32(System.UInt32,System.Int32)Windows.UI.Text.ITextRange.GetCharacterUtf32(System.UInt32,System.Int32)Windows.UI.Text.ITextRange.GetCharacterUtf32(System.UInt32,System.Int32)Windows.UI.Text.ITextRange.GetCharacterUtf32(System.UInt32,System.Int32)
Windows.UI.Text.ITextRange.GetPoint(Windows.UI.Text.HorizontalCharacterAlignment,Windows.UI.Text.VerticalCharacterAlignment,Windows.UI.Text.PointOptions,Windows.Foundation.Point)Windows.UI.Text.ITextRange.GetPoint(Windows.UI.Text.HorizontalCharacterAlignment,Windows.UI.Text.VerticalCharacterAlignment,Windows.UI.Text.PointOptions,Windows.Foundation.Point)Windows.UI.Text.ITextRange.GetPoint(Windows.UI.Text.HorizontalCharacterAlignment,Windows.UI.Text.VerticalCharacterAlignment,Windows.UI.Text.PointOptions,Windows.Foundation.Point)Windows.UI.Text.ITextRange.GetPoint(Windows.UI.Text.HorizontalCharacterAlignment,Windows.UI.Text.VerticalCharacterAlignment,Windows.UI.Text.PointOptions,Windows.Foundation.Point)
Windows.UI.Text.ITextRange.GetRect(Windows.UI.Text.PointOptions,Windows.Foundation.Rect,System.Int32)Windows.UI.Text.ITextRange.GetRect(Windows.UI.Text.PointOptions,Windows.Foundation.Rect,System.Int32)Windows.UI.Text.ITextRange.GetRect(Windows.UI.Text.PointOptions,Windows.Foundation.Rect,System.Int32)Windows.UI.Text.ITextRange.GetRect(Windows.UI.Text.PointOptions,Windows.Foundation.Rect,System.Int32)
Windows.UI.Text.ITextRange.GetText(Windows.UI.Text.TextGetOptions,System.String)Windows.UI.Text.ITextRange.GetText(Windows.UI.Text.TextGetOptions,System.String)Windows.UI.Text.ITextRange.GetText(Windows.UI.Text.TextGetOptions,System.String)Windows.UI.Text.ITextRange.GetText(Windows.UI.Text.TextGetOptions,System.String)

Remarks

Interface inheritance

ITextSelection inherits ITextRange. Types that implement ITextSelection also implement the interface members of ITextRange.

Properties

Options Options Options Options

Gets and sets text selection options.

public : SelectionOptions Options { get; set; }public SelectionOptions Options { get; set; }Public ReadWrite Property Options As SelectionOptions// This API is not available in Javascript.
Value
SelectionOptions SelectionOptions SelectionOptions SelectionOptions

The text selection options. Each option is binary, so if a particular option is not set, the text selection has the opposite option. For example, if the Overtype option is not set, the text selection is set to insert mode.

Type Type Type Type

Retrieves the type of text selection.

public : SelectionType Type { get; }public SelectionType Type { get; }Public ReadOnly Property Type As SelectionType// This API is not available in Javascript.

Methods

EndKey(TextRangeUnit, Boolean) EndKey(TextRangeUnit, Boolean) EndKey(TextRangeUnit, Boolean) EndKey(TextRangeUnit, Boolean)

Moves the insertion point or the active end of the text selection to the end of the specified unit, mimicking the functionality of the End key.

public : int EndKey(TextRangeUnit unit, bool extend)public int EndKey(TextRangeUnit unit, Boolean extend)Public Function EndKey(unit As TextRangeUnit, extend As Boolean) As int// This API is not available in Javascript.
Parameters
unit
TextRangeUnit TextRangeUnit TextRangeUnit TextRangeUnit

The units by which to move the insertion point or active end. The following values are valid.

extend
bool Boolean Boolean Boolean

Indicates how to change the selection. True extends the selection by moving only the active end. False collapses the selection to an insertion point and then moves the insertion point. The default value is false.

Returns
int int int int

The number of units that the insertion point or the active end is moved.

Remarks

The EndKey method is a logical method rather than a directional method and so is dependent on the language that is involved. For example, in Arabic text, EndKey moves to the left end of a line, whereas in English text, it moves to the right. Thus EndKey is different from the ITextSelection.MoveRight or ITextSelection.MoveLeft methods. Also, note that the EndKey method is quite different from the End property, which is the character position at the end of the selection. EndKey also differs from the ITextRange.EndOf method in that it extends from the active end, whereas EndOf extends from End.

See Also

HomeKey(TextRangeUnit, Boolean) HomeKey(TextRangeUnit, Boolean) HomeKey(TextRangeUnit, Boolean) HomeKey(TextRangeUnit, Boolean)

Moves the insertion point or the active end of the text selection to the home position, mimicking the functionality of the Home key.

public : int HomeKey(TextRangeUnit unit, bool extend)public int HomeKey(TextRangeUnit unit, Boolean extend)Public Function HomeKey(unit As TextRangeUnit, extend As Boolean) As int// This API is not available in Javascript.
Parameters
unit
TextRangeUnit TextRangeUnit TextRangeUnit TextRangeUnit

The units by which to move the insertion point or active end. The following values are valid.

extend
bool Boolean Boolean Boolean

Indicates how to change the selection. True extends the selection by moving only the active end. False collapses the selection to an insertion point and then moves the insertion point. The default value is false.

Returns
int int int int

The number of units that the insertion point or the active end is moved.

Remarks

The HomeKey method is a logical method rather than a directional method and so is dependent on the language that is involved. For example, in Arabic text, HomeKey moves to the right end of a line, whereas in English text, it moves to the left. Thus HomeKey is different from the ITextSelection.MoveRight or ITextSelection.MoveLeft methods. HomeKey also differs from the ITextRange.StartOf method in that it extends from the active end, whereas StartOf extends from the start position.

See Also

MoveDown(TextRangeUnit, Int32, Boolean) MoveDown(TextRangeUnit, Int32, Boolean) MoveDown(TextRangeUnit, Int32, Boolean) MoveDown(TextRangeUnit, Int32, Boolean)

Moves the insertion point or the active end of the text selection down, mimicking the functionality of the Down Arrow or Page Down key.

public : int MoveDown(TextRangeUnit unit, int count, bool extend)public int MoveDown(TextRangeUnit unit, Int32 count, Boolean extend)Public Function MoveDown(unit As TextRangeUnit, count As Int32, extend As Boolean) As int// This API is not available in Javascript.
Parameters
unit
TextRangeUnit TextRangeUnit TextRangeUnit TextRangeUnit

The units by which to move the insertion point or active end. The following values are valid.

ValueCorresponding key combinationMeaning
LineDown ArrowMoves down one line. This is the default.
ParagraphCtrl+Down ArrowMoves down one paragraph.
ScreenPage DownMoves down one screen.
WindowCtrl+Page DownMoves to the last character in the window.

count
int Int32 Int32 Int32

The number of units to move. The default value is 1.

extend
bool Boolean Boolean Boolean

Indicates how to change the selection. True extends the selection by moving only the active end. False collapses the selection to an insertion point and then moves the insertion point. The default value is false.

Returns
int int int int

The number of units that the insertion point or active end moved down. Collapsing the selection counts as one unit.

Remarks

A nonzero extend value corresponds to the Shift key being pressed in addition to the key combination described in unit.

See Also

MoveLeft(TextRangeUnit, Int32, Boolean) MoveLeft(TextRangeUnit, Int32, Boolean) MoveLeft(TextRangeUnit, Int32, Boolean) MoveLeft(TextRangeUnit, Int32, Boolean)

Moves the insertion point or the active end of the text selection to the left, mimicking the functionality of the Left Arrow key.

public : int MoveLeft(TextRangeUnit unit, int count, bool extend)public int MoveLeft(TextRangeUnit unit, Int32 count, Boolean extend)Public Function MoveLeft(unit As TextRangeUnit, count As Int32, extend As Boolean) As int// This API is not available in Javascript.
Parameters
unit
TextRangeUnit TextRangeUnit TextRangeUnit TextRangeUnit

The units by which to move the insertion point or active end. The following values are valid.

ValueCorresponding key combinationMeaning
CharacterLeft ArrowMove one character position to the left. This is the default.
WordCtrl+Left ArrowMove one word to the left.

count
int Int32 Int32 Int32

The number of units to move. The default value is 1. If count is less than zero, movement is to the right.

extend
bool Boolean Boolean Boolean

Indicates how to change the selection. True extends the selection by moving only the active end. False collapses the selection to an insertion point and then moves the insertion point. The default value is false.

Returns
int int int int

The number of units that the insertion point or active end moved. Collapsing the selection counts as one unit.

Remarks

A nonzero extend value corresponds to the Shift key being pressed in addition to the key combination described in unit.

See Also

MoveRight(TextRangeUnit, Int32, Boolean) MoveRight(TextRangeUnit, Int32, Boolean) MoveRight(TextRangeUnit, Int32, Boolean) MoveRight(TextRangeUnit, Int32, Boolean)

Moves the insertion point or the active end of the text selection to the right, mimicking the functionality of the Right Arrow key.

public : int MoveRight(TextRangeUnit unit, int count, bool extend)public int MoveRight(TextRangeUnit unit, Int32 count, Boolean extend)Public Function MoveRight(unit As TextRangeUnit, count As Int32, extend As Boolean) As int// This API is not available in Javascript.
Parameters
unit
TextRangeUnit TextRangeUnit TextRangeUnit TextRangeUnit

The units by which to move the insertion point or active end. The following values are valid.

ValueCorresponding key combinationMeaning
CharacterRight ArrowMove one character position to the right. This is the default.
WordCtrl+Right ArrowMove one word to the right.

count
int Int32 Int32 Int32

The number of units to move. The default value is 1. If count is less than zero, movement is to the left.

extend
bool Boolean Boolean Boolean

Indicates how to change the selection. True extends the selection by moving only the active end. False collapses the selection to an insertion point and then moves the insertion point. The default value is false.

Returns
int int int int

The number of units that the insertion point or active end moved. Collapsing the selection counts as one unit.

Remarks

A nonzero extend value corresponds to the Shift key being pressed in addition to the key combination described in unit.

See Also

MoveUp(TextRangeUnit, Int32, Boolean) MoveUp(TextRangeUnit, Int32, Boolean) MoveUp(TextRangeUnit, Int32, Boolean) MoveUp(TextRangeUnit, Int32, Boolean)

Moves the insertion point or the active end of the text selection up, mimicking the functionality of the Up Arrow or Page Up keys.

public : int MoveUp(TextRangeUnit unit, int count, bool extend)public int MoveUp(TextRangeUnit unit, Int32 count, Boolean extend)Public Function MoveUp(unit As TextRangeUnit, count As Int32, extend As Boolean) As int// This API is not available in Javascript.
Parameters
unit
TextRangeUnit TextRangeUnit TextRangeUnit TextRangeUnit

The units by which to move the insertion point or active end. The following values are valid.

ValueCorresponding key combinationMeaning
LineUp ArrowMoves up one line. This is the default.
ParagraphCtrl+Up ArrowMoves up one paragraph.
ScreenPage UpMoves up one screen.
WindowCtrl+Page UpMoves to the first character in the window.

count
int Int32 Int32 Int32

The number of units to move. The default value is 1.

extend
bool Boolean Boolean Boolean

Indicates how to change the selection. True extends the selection by moving only the active end. False collapses the selection to an insertion point and then moves the insertion point. The default value is false.

Returns
int int int int

The number of units the insertion point or active end is moved down. Collapsing the selection counts as one unit.

Remarks

A nonzero extend value corresponds to the Shift key being pressed in addition to the key combination described in unit.

See Also

TypeText(String) TypeText(String) TypeText(String) TypeText(String)

Enters text into the selection as if someone typed it.

public : void TypeText(PlatForm::String value)public void TypeText(String value)Public Function TypeText(value As String) As void// This API is not available in Javascript.
Parameters
value
PlatForm::String String String String

The text string to type into this selection.

Remarks

This method is similar to the underlying ITextDocument.SetText method, but is sensitive to the Insert or Overtype key state and UI settings like AutoCorrect and smart quotes.

See Also