New to Telerik Document ProcessingStart a free 30-day trial

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:

C#
public class TextPosition

Inheritance: objectTextPosition

Constructors

Initializes a new instance of the TextPosition class.

C#
public TextPosition(RadFixedDocument document)
Parameters:documentRadFixedDocument

The document.

Initializes a new instance of the TextPosition class.

C#
public TextPosition(RadFixedPage page, int index)
Parameters:pageRadFixedPage

The page.

indexint

The index.

Initializes a new instance of the TextPosition class.

C#
public TextPosition(RadFixedPage page)
Parameters:pageRadFixedPage

The page.

Initializes a new instance of the TextPosition class.

C#
public TextPosition(TextPosition position)
Parameters:positionTextPosition

The position.

Events

Raised immediately after the position changes to a new page/index location.

C#
public event EventHandler PositionChanged

Raised just before the position changes, allowing observers to capture state prior to movement.

C#
public event EventHandler PositionChanging

Methods

Determines whether the specified object is a TextPosition at the same index on the same page (throws if from a different document).

C#
public override bool Equals(object obj)
Parameters:objobject

The object to compare with the current object.

Returns:

bool

True if the specified object is equal to the current object; otherwise, false.

Overrides: object.Equals(object)

Generates a hash code combining page and index so the position can be used in hash-based collections.

C#
public override int GetHashCode()
Returns:

int

A hash code for the current object.

Overrides: object.GetHashCode()

Gets the bounding rectangle of the word containing the current position.

C#
public Rect GetWordBoundingRect()
Returns:

Rect

The bounding rectangle of the current word.

Moves to the corresponding position in the line below the current line.

C#
public bool MoveLineDown()
Returns:

bool

True if the move to the line below was successful; otherwise, false.

Moves to the corresponding position in the line above the current line.

C#
public bool MoveLineUp()
Returns:

bool

True if the move to the line above was successful; otherwise, false.

Moves to the end of the current word.

C#
public bool MoveToCurrentWordEnd()
Returns:

bool

True if the move to the current word end was successful; otherwise, false.

Moves to the start of the current word.

C#
public bool MoveToCurrentWordStart()
Returns:

bool

True if the move to the current word start was successful; otherwise, false.

Moves to the end (last position) of the document.

C#
public bool MoveToEndOfDocument()
Returns:

bool

True if the move to the end of the document was successful; otherwise, false.

Moves to the end of the current line.

C#
public bool MoveToLineEnd()
Returns:

bool

True if the move to the line end was successful; otherwise, false.

Moves to the start of the current line.

C#
public bool MoveToLineStart()
Returns:

bool

True if the move to the line start was successful; otherwise, false.

Moves to the next position in the document.

C#
public bool MoveToNextPosition()
Returns:

bool

True if the move to the next position was successful; otherwise, false.

Moves to the beginning of the next word in the document.

C#
public bool MoveToNextWord()
Returns:

bool

True if the move to the next word was successful; otherwise, false.

Moves this position to match another valid position within the same document.

C#
public bool MoveToPosition(TextPosition position)
Parameters:positionTextPosition

The target position to move to. Must be from the same document.

Returns:

bool

True if the move operation was successful; otherwise, false.

Moves to the previous position in the document.

C#
public bool MoveToPreviousPosition()
Returns:

bool

True if the move to the previous position was successful; otherwise, false.

Moves to the beginning of the previous word in the document.

C#
public bool MoveToPreviousWord()
Returns:

bool

True if the move to the previous word was successful; otherwise, false.

Moves to the beginning (first position) of the document.

C#
public bool MoveToStartOfDocument()
Returns:

bool

True if the move to the start of the document was successful; otherwise, false.

Called when TextPosition is changed.

C#
protected virtual void OnPositionChanged()

Called when TextPosition is changing.

C#
protected virtual void OnPositionChanging()

Returns a string showing the current word split at the caret position (text before and after the index separated by '@').

C#
public override string ToString()
Returns:

string

A string that represents the current object.

Overrides: object.ToString()

Operators

Returns true if the two positions differ in page or index (must belong to the same document).

C#
public static bool operator !=(TextPosition left, TextPosition right)
Parameters:leftTextPosition

Left text position.

rightTextPosition

Right text position.

Returns:

bool

Returns if the two positions are not equal.

Returns true if the left position precedes the right one in document reading order (same document required).

C#
public static bool operator <(TextPosition left, TextPosition right)
Parameters:leftTextPosition

Left text position.

rightTextPosition

Right text position.

Returns:

bool

Returns if the left position is less than the right position.

Returns true if the left position precedes or equals the right one (positions must originate from the same document).

C#
public static bool operator <=(TextPosition left, TextPosition right)
Parameters:leftTextPosition

Left text position.

rightTextPosition

Right text position.

Returns:

bool

Returns if the left position is less than or equals to the right position.

Returns true if two positions reference the same page and index within the same document.

C#
public static bool operator ==(TextPosition left, TextPosition right)
Parameters:leftTextPosition

Left text position.

rightTextPosition

Right text position.

Returns:

bool

Returns if the two positions are equal.

Returns true if the left position follows the right one in document reading order (same document required).

C#
public static bool operator >(TextPosition left, TextPosition right)
Parameters:leftTextPosition

Left text position.

rightTextPosition

Right text position.

Returns:

bool

Returns if the left position is greater than the right position.

Returns true if the left position follows or equals the right one (positions must originate from the same document).

C#
public static bool operator >=(TextPosition left, TextPosition right)
Parameters:leftTextPosition

Left text position.

rightTextPosition

Right text position.

Returns:

bool

Returns if the left position is greater than or equals to the right position.

Properties

Gets the zero-based character index within the current text page.

C#
public int Index { get; }
Property Value:

The index.

Gets the fixed page that currently contains this text position.

C#
public RadFixedPage Page { get; }
Property Value:

The page.