ClassTextPosition
Cursor-like handle to a precise character index within a fixed document page, enabling navigation (by character, word, line, or page) and retrieval of positional metadata.
Definition
Namespace:Telerik.Windows.Documents.Fixed.Text
Assembly:Telerik.Windows.Documents.Fixed.dll
Syntax:
public class TextPosition
Inheritance: objectTextPosition
Constructors
TextPosition(RadFixedDocument)
Initializes a new instance of the TextPosition class.
Declaration
public TextPosition(RadFixedDocument document)
Parameters
document
The document.
TextPosition(RadFixedPage)
Initializes a new instance of the TextPosition class.
Declaration
public TextPosition(RadFixedPage page)
Parameters
page
The page.
TextPosition(RadFixedPage, int)
Initializes a new instance of the TextPosition class.
Declaration
public TextPosition(RadFixedPage page, int index)
Parameters
page
The page.
index
The index.
TextPosition(TextPosition)
Initializes a new instance of the TextPosition class.
Declaration
public TextPosition(TextPosition position)
Parameters
position
The position.
Properties
Index
Gets the zero-based character index within the current text page.
Page
Gets the fixed page that currently contains this text position.
Declaration
public RadFixedPage Page { get; }
Property Value
The page.
Methods
Equals(object)
Determines whether the specified object is a TextPosition at the same index on the same page (throws if from a different document).
GetHashCode()
Generates a hash code combining page and index so the position can be used in hash-based collections.
GetWordBoundingRect()
Gets the bounding rectangle of the word containing the current position.
Declaration
public Rect GetWordBoundingRect()
Returns
The bounding rectangle of the current word.
MoveLineDown()
Moves to the corresponding position in the line below the current line.
Declaration
public bool MoveLineDown()
Returns
True if the move to the line below was successful; otherwise, false.
MoveLineUp()
Moves to the corresponding position in the line above the current line.
Declaration
public bool MoveLineUp()
Returns
True if the move to the line above was successful; otherwise, false.
MoveToCurrentWordEnd()
Moves to the end of the current word.
Declaration
public bool MoveToCurrentWordEnd()
Returns
True if the move to the current word end was successful; otherwise, false.
MoveToCurrentWordStart()
Moves to the start of the current word.
Declaration
public bool MoveToCurrentWordStart()
Returns
True if the move to the current word start was successful; otherwise, false.
MoveToEndOfDocument()
Moves to the end (last position) of the document.
Declaration
public bool MoveToEndOfDocument()
Returns
True if the move to the end of the document was successful; otherwise, false.
MoveToLineEnd()
Moves to the end of the current line.
Declaration
public bool MoveToLineEnd()
Returns
True if the move to the line end was successful; otherwise, false.
MoveToLineStart()
Moves to the start of the current line.
Declaration
public bool MoveToLineStart()
Returns
True if the move to the line start was successful; otherwise, false.
MoveToNextPosition()
Moves to the next position in the document.
Declaration
public bool MoveToNextPosition()
Returns
True if the move to the next position was successful; otherwise, false.
MoveToNextWord()
Moves to the beginning of the next word in the document.
Declaration
public bool MoveToNextWord()
Returns
True if the move to the next word was successful; otherwise, false.
MoveToPosition(TextPosition)
Moves this position to match another valid position within the same document.
Declaration
public bool MoveToPosition(TextPosition position)
Parameters
position
The target position to move to. Must be from the same document.
Returns
True if the move operation was successful; otherwise, false.
MoveToPreviousPosition()
Moves to the previous position in the document.
Declaration
public bool MoveToPreviousPosition()
Returns
True if the move to the previous position was successful; otherwise, false.
MoveToPreviousWord()
Moves to the beginning of the previous word in the document.
Declaration
public bool MoveToPreviousWord()
Returns
True if the move to the previous word was successful; otherwise, false.
MoveToStartOfDocument()
Moves to the beginning (first position) of the document.
Declaration
public bool MoveToStartOfDocument()
Returns
True if the move to the start of the document was successful; otherwise, false.
OnPositionChanged()
Called when TextPosition is changed.
Declaration
protected virtual void OnPositionChanged()
OnPositionChanging()
Called when TextPosition is changing.
Declaration
protected virtual void OnPositionChanging()
ToString()
Returns a string showing the current word split at the caret position (text before and after the index separated by '@').
Declaration
public override string ToString()
Returns
A string that represents the current object.
Overrides
Events
PositionChanged
Raised immediately after the position changes to a new page/index location.
PositionChanging
Raised just before the position changes, allowing observers to capture state prior to movement.
Operators
operator !=(TextPosition, TextPosition)
Returns true if the two positions differ in page or index (must belong to the same document).
Declaration
public static bool operator !=(TextPosition left, TextPosition right)
Parameters
left
Left text position.
right
Right text position.
Returns
Returns if the two positions are not equal.
operator <(TextPosition, TextPosition)
Returns true if the left position precedes the right one in document reading order (same document required).
Declaration
public static bool operator <(TextPosition left, TextPosition right)
Parameters
left
Left text position.
right
Right text position.
Returns
Returns if the left position is less than the right position.
operator <=(TextPosition, TextPosition)
Returns true if the left position precedes or equals the right one (positions must originate from the same document).
Declaration
public static bool operator <=(TextPosition left, TextPosition right)
Parameters
left
Left text position.
right
Right text position.
Returns
Returns if the left position is less than or equals to the right position.
operator ==(TextPosition, TextPosition)
Returns true if two positions reference the same page and index within the same document.
Declaration
public static bool operator ==(TextPosition left, TextPosition right)
Parameters
left
Left text position.
right
Right text position.
Returns
Returns if the two positions are equal.
operator >(TextPosition, TextPosition)
Returns true if the left position follows the right one in document reading order (same document required).
Declaration
public static bool operator >(TextPosition left, TextPosition right)
Parameters
left
Left text position.
right
Right text position.
Returns
Returns if the left position is greater than the right position.
operator >=(TextPosition, TextPosition)
Returns true if the left position follows or equals the right one (positions must originate from the same document).
Declaration
public static bool operator >=(TextPosition left, TextPosition right)
Parameters
left
Left text position.
right
Right text position.
Returns
Returns if the left position is greater than or equals to the right position.