Class TextPointer
Represents a position within a RichTextBox.
Inheritance
Inherited Members
Namespace: System.Windows.Documents
Assembly: OpenSilver.dll
Syntax
public class TextPointer
Properties
| Improve this Doc View SourceIsAtInsertionPosition
Gets a value that indicates whether the current position is an insertion.
Declaration
public bool IsAtInsertionPosition { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if the current position is an insertion position; otherwise, false. |
LogicalDirection
Gets the logical direction associated with the current position, which is used to disambiguate content associated with the current position.
Declaration
public LogicalDirection LogicalDirection { get; }
Property Value
| Type | Description |
|---|---|
| LogicalDirection | The LogicalDirection value that is associated with the current position. |
Parent
Gets the logical parent that contains the current position.
Declaration
[NotImplemented]
public DependencyObject Parent { get; }
Property Value
| Type | Description |
|---|---|
| DependencyObject | The logical parent that contains the current position. Can return the RichTextBox when at the top of the content stack. |
VisualParent
Gets the visual tree parent of the TextPointer object.
Declaration
public FrameworkElement VisualParent { get; }
Property Value
| Type | Description |
|---|---|
| FrameworkElement | The visual tree parent of the TextPointer object. |
Methods
| Improve this Doc View SourceCompareTo(TextPointer)
Performs an ordinal comparison between the positions specified by the current TextPointer and a second specified TextPointer.
Declaration
public int CompareTo(TextPointer position)
Parameters
| Type | Name | Description |
|---|---|---|
| TextPointer | position | A TextPointer that specifies a position to compare to the current position. |
Returns
| Type | Description |
|---|---|
| System.Int32 | -1 if the current TextPointer precedes position; 0 if the locations are the same; +1 if the current TextPointer follows positions. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | position is null. |
| System.ArgumentException | position specifies a position from a different RichTextBox associated with the current position. |
GetCharacterRect(LogicalDirection)
Returns a bounding box for content that borders the current TextPointer in the specified logical direction.
Declaration
[NotImplemented]
public Rect GetCharacterRect(LogicalDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| LogicalDirection | direction | One of the LogicalDirection values that specify the logical direction in which to find a content bounding box. |
Returns
| Type | Description |
|---|---|
| Rect | A Rect for content that borders the current TextPointer in the specified direction, or Empty if current and valid layout information is unavailable. |
GetNextInsertionPosition(LogicalDirection)
Returns a TextPointer to the next insertion position in the specified logical direction.
Declaration
public TextPointer GetNextInsertionPosition(LogicalDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| LogicalDirection | direction | One of the LogicalDirection values that specify the logical direction in which to search for the next insertion position. |
Returns
| Type | Description |
|---|---|
| TextPointer | A TextPointer that identifies the next insertion position in the requested direction, or null if no next insertion position can be found. |
GetPositionAtOffset(Int32, LogicalDirection)
Returns a TextPointer to the position indicated by the specified offset, in symbols, from the beginning of the current TextPointer and in the specified direction.
Declaration
public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | An offset, in symbols, for which to calculate and return the position. If the offset is negative, the returned TextPointer precedes the current TextPointer; otherwise, it follows. |
| LogicalDirection | direction | One of the LogicalDirection values that specifies the logical direction of the returned TextPointer. |
Returns
| Type | Description |
|---|---|
| TextPointer | A TextPointer to the position indicated by the specified offset and in the direction specified by the direction parameter, or null if the offset extends past the end of the content. |