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
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited methods
Inherited properties
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.
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.
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.
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.
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.
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.
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.
The units by which to move the insertion point or active end. The following values are valid.
| Value | Corresponding key combination | Meaning |
|---|---|---|
| Line | Down Arrow | Moves down one line. This is the default. |
| Paragraph | Ctrl+Down Arrow | Moves down one paragraph. |
| Screen | Page Down | Moves down one screen. |
| Window | Ctrl+Page Down | Moves 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.
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.
The units by which to move the insertion point or active end. The following values are valid.
| Value | Corresponding key combination | Meaning |
|---|---|---|
| Character | Left Arrow | Move one character position to the left. This is the default. |
| Word | Ctrl+Left Arrow | Move 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.
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.
The units by which to move the insertion point or active end. The following values are valid.
| Value | Corresponding key combination | Meaning |
|---|---|---|
| Character | Right Arrow | Move one character position to the right. This is the default. |
| Word | Ctrl+Right Arrow | Move 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.
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.
The units by which to move the insertion point or active end. The following values are valid.
| Value | Corresponding key combination | Meaning |
|---|---|---|
| Line | Up Arrow | Moves up one line. This is the default. |
| Paragraph | Ctrl+Up Arrow | Moves up one paragraph. |
| Screen | Page Up | Moves up one screen. |
| Window | Ctrl+Page Up | Moves 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.
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.
- 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.