Class
DocumentPosition

Represents position in RadDocument.

Definition

Namespace:Telerik.Windows.Documents

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

cs-api-definition
public class DocumentPosition : IComparable<DocumentPosition>, IDisposable

Inheritance: objectDocumentPosition

Implements: IComparable<DocumentPosition>IDisposable

Constructors

DocumentPosition(DocumentLayoutBox)

Initializes a new instance of the DocumentPosition class.

Declaration

cs-api-definition
public DocumentPosition(DocumentLayoutBox documentBox)

Parameters

documentBox

DocumentLayoutBox

The DocumentLayoutBox of RadDocument.

DocumentPosition(DocumentLayoutBox, bool)

Initializes a new instance of the DocumentPosition class.

Declaration

cs-api-definition
public DocumentPosition(DocumentLayoutBox documentBox, bool trackDocumentChangeEvents)

Parameters

documentBox

DocumentLayoutBox

The DocumentLayoutBox of RadDocument in which the position will be used.

trackDocumentChangeEvents

bool

Indicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.

DocumentPosition(DocumentPosition)

Initializes a new instance of the DocumentPosition class.

Declaration

cs-api-definition
public DocumentPosition(DocumentPosition documentPosition)

Parameters

documentPosition

DocumentPosition

The document position to copy.

DocumentPosition(DocumentPosition, bool)

Initializes a new instance of the DocumentPosition class.

Declaration

cs-api-definition
public DocumentPosition(DocumentPosition documentPosition, bool trackDocumentChangeEvents)

Parameters

documentPosition

DocumentPosition

The document position to copy.

trackDocumentChangeEvents

bool

Indicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.

DocumentPosition(RadDocument)

Initializes a new instance of the DocumentPosition class.

Declaration

cs-api-definition
public DocumentPosition(RadDocument document)

Parameters

document

RadDocument

An instance of RadDocument in which the position will be used.

DocumentPosition(RadDocument, bool)

Initializes a new instance of the DocumentPosition class.

Declaration

cs-api-definition
public DocumentPosition(RadDocument document, bool trackDocumentChangeEvents)

Parameters

document

RadDocument

An instance of RadDocument in which the position will be used.

trackDocumentChangeEvents

bool

Indicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.

Properties

IsPositionAtDocumentEnd

Determines whether the DocumentPosition is at the end of the document.

Declaration

cs-api-definition
public bool IsPositionAtDocumentEnd { get; }

Property Value

bool

IsPositionAtDocumentStart

Determines whether the DocumentPosition is at the start of the document.

Declaration

cs-api-definition
public bool IsPositionAtDocumentStart { get; }

Property Value

bool

IsPositionAtParagraphEnd

Determines whether the DocumentPosition is at the end of a Paragraph.

Declaration

cs-api-definition
public bool IsPositionAtParagraphEnd { get; }

Property Value

bool

IsPositionAtParagraphStart

Determines whether the DocumentPosition is at the start of a Paragraph.

Declaration

cs-api-definition
public bool IsPositionAtParagraphStart { get; }

Property Value

bool

IsPositionAtTableCellEnd

Determines whether the DocumentPosition is at the end of a TableCell.

Declaration

cs-api-definition
public bool IsPositionAtTableCellEnd { get; }

Property Value

bool

IsPositionAtTableCellStart

Determines whether the DocumentPosition is at the start of a TableCell.

Declaration

cs-api-definition
public bool IsPositionAtTableCellStart { get; }

Property Value

bool

IsPositionAtTableRowStart

Determines whether the DocumentPosition is at the start of a TableRow.

Declaration

cs-api-definition
public bool IsPositionAtTableRowStart { get; }

Property Value

bool

IsPositionInsideTable

Gets a value indicating whether this position is inside table.

Declaration

cs-api-definition
public bool IsPositionInsideTable { get; }

Property Value

bool

true if this position is inside table; otherwise, false.

Location

Gets a value representing the layout position of this document position.

Declaration

cs-api-definition
public PointF Location { get; }

Property Value

PointF

Methods

CompareTo(DocumentPosition)

Compares the current object with another object of the same type.

Declaration

cs-api-definition
public int CompareTo(DocumentPosition other)

Parameters

other

DocumentPosition

An object to compare with this object.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.

Implements IComparable<DocumentPosition>.CompareTo(DocumentPosition)

Dispose()

Disposes this DocumentPosition.

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

Equals(object)

Determines whether the specified object, is equal to this instance.

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

Overrides object.Equals(object)

GetCurrentInline()

Gets the current Inline.

Declaration

cs-api-definition
public Inline GetCurrentInline()

Returns

Inline

The current Inline element if the position is in an Inline. Otherwise, null.

GetCurrentInlineBox()

Gets the current InlineLayoutBox.

Declaration

cs-api-definition
public InlineLayoutBox GetCurrentInlineBox()

Returns

InlineLayoutBox

The current InlineLayoutBox. If such cannot be found, the method returns null.

GetCurrentParagraph()

Gets the current Paragraph.

Declaration

cs-api-definition
public Paragraph GetCurrentParagraph()

Returns

Paragraph

The current Paragraph element if the position is in a Paragraph. Otherwise, null.

GetCurrentParagraphBox()

Gets the current ParagraphLayoutBox.

Declaration

cs-api-definition
public ParagraphLayoutBox GetCurrentParagraphBox()

Returns

ParagraphLayoutBox

The current ParagraphLayoutBox. If such cannot be found, the method returns null.

GetCurrentSectionBox()

Gets the current SectionLayoutBox.

Declaration

cs-api-definition
public SectionLayoutBox GetCurrentSectionBox()

Returns

SectionLayoutBox

The current SectionLayoutBox. If such cannot be found, the method returns null.

GetCurrentSpan()

Gets the current Span.

Declaration

cs-api-definition
public Span GetCurrentSpan()

Returns

Span

The current Span element if the position is in a Span. Otherwise, null.

GetCurrentSpanBox()

Gets the current SpanLayoutBox.

Declaration

cs-api-definition
public SpanLayoutBox GetCurrentSpanBox()

Returns

SpanLayoutBox

The current SpanLayoutBox. If such cannot be found, the method returns null.

GetCurrentTable()

Gets the current Table.

Declaration

cs-api-definition
public Table GetCurrentTable()

Returns

Table

The current Table element if the position is in a Table. Otherwise, null.

GetCurrentTableBox()

Gets the current TableLayoutBox.

Declaration

cs-api-definition
public TableLayoutBox GetCurrentTableBox()

Returns

TableLayoutBox

The current TableLayoutBox. If such cannot be found, the method returns null.

GetCurrentTableCell()

Gets the current TableCell.

Declaration

cs-api-definition
public TableCell GetCurrentTableCell()

Returns

TableCell

The current TableCell element if the position is in a TableCell. Otherwise, null.

GetCurrentTableCellBox()

Gets the current TableCellLayoutBox.

Declaration

cs-api-definition
public TableCellLayoutBox GetCurrentTableCellBox()

Returns

TableCellLayoutBox

The current TableCellLayoutBox. If such cannot be found, the method returns null.

GetCurrentTableRow()

Gets the current TableRow.

Declaration

cs-api-definition
public TableRow GetCurrentTableRow()

Returns

TableRow

The current TableRow element if the position is in a TableRow. Otherwise, null.

GetCurrentTableRowBox()

Gets the current TableRowLayoutBox.

Declaration

cs-api-definition
public TableRowLayoutBox GetCurrentTableRowBox()

Returns

TableRowLayoutBox

The current TableRowLayoutBox. If such cannot be found, the method returns null.

GetCurrentWord()

Gets the current word.

Declaration

cs-api-definition
public string GetCurrentWord()

Returns

string

The current word.

GetHashCode()

Returns a hash code for this instance.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Overrides object.GetHashCode()

GetIndexInCurrentSpan()

Gets the index of the position in the current span.

Declaration

cs-api-definition
public int GetIndexInCurrentSpan()

Returns

int

The index of the position in the current span.

GetIndexInCurrentSpanBox()

Gets the index of the position in the current SpanLayoutBox.

Declaration

cs-api-definition
public int GetIndexInCurrentSpanBox()

Returns

int

The index of the position in the current SpanLayoutBox.

GetNextInline()

Gets the next Inline element.

Declaration

cs-api-definition
public Inline GetNextInline()

Returns

Inline

The next Inline element. If such cannot be found, the method returns null.

GetNextInlineBox()

Gets the next InlineLayoutBox.

Declaration

cs-api-definition
public InlineLayoutBox GetNextInlineBox()

Returns

InlineLayoutBox

The next InlineLayoutBox. If such cannot be found, the method returns null.

GetNextSpanBox()

Gets the next SpanLayoutBox.

Declaration

cs-api-definition
public SpanLayoutBox GetNextSpanBox()

Returns

SpanLayoutBox

The next SpanLayoutBox. If such cannot be found, the method returns null.

GetPreviousInline()

Gets the previous Inline.

Declaration

cs-api-definition
public Inline GetPreviousInline()

Returns

Inline

The previous Inline element. If such cannot be found, the method returns null.

GetPreviousInlineBox()

Gets the previous InlineLayoutBox.

Declaration

cs-api-definition
public InlineLayoutBox GetPreviousInlineBox()

Returns

InlineLayoutBox

The previous InlineLayoutBox. If such cannot be found, the method returns null.

GetPreviousSpanBox()

Gets the previous SpanLayoutBox.

Declaration

cs-api-definition
public SpanLayoutBox GetPreviousSpanBox()

Returns

SpanLayoutBox

The previous SpanLayoutBox. If such cannot be found, the method returns null.

MoveDown()

Moves the position down.

Declaration

cs-api-definition
public bool MoveDown()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToCurrentLineEnd()

Moves the position to the end of the current line.

Declaration

cs-api-definition
public bool MoveToCurrentLineEnd()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToCurrentLineStart()

Moves the position to the start of the current line.

Declaration

cs-api-definition
public bool MoveToCurrentLineStart()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToCurrentWordEnd()

Moves the position to the end of the current word.

Declaration

cs-api-definition
public void MoveToCurrentWordEnd()

MoveToCurrentWordStart()

Moves the position to the start of the current word.

Declaration

cs-api-definition
public void MoveToCurrentWordStart()

MoveToDocumentElementEnd(DocumentElement)

Moves the position to the end of a document element.

Declaration

cs-api-definition
public void MoveToDocumentElementEnd(DocumentElement element)

Parameters

element

DocumentElement

The document element.

MoveToDocumentElementStart(DocumentElement)

Moves the position to the start of a document element.

Declaration

cs-api-definition
public void MoveToDocumentElementStart(DocumentElement element)

Parameters

element

DocumentElement

The document element.

MoveToDocumentEnd()

Moves the position to the last position in the document.

Declaration

cs-api-definition
public void MoveToDocumentEnd()

MoveToDocumentStart()

Moves the position to the first position in the document.

Declaration

cs-api-definition
public void MoveToDocumentStart()

MoveToInline(Inline)

Moves the position to the start of an Inline.

Declaration

cs-api-definition
public void MoveToInline(Inline inline)

Parameters

inline

Inline

MoveToInline(InlineLayoutBox, int)

Moves the position to InlineLayoutBox.

Declaration

cs-api-definition
public void MoveToInline(InlineLayoutBox inlineLayoutBox, int index)

Parameters

inlineLayoutBox

InlineLayoutBox

The InlineLayoutBox.

index

int

The index in the InlineLayoutBox.

MoveToNext()

Moves the position to the next possible position in the document.

Declaration

cs-api-definition
public bool MoveToNext()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToNextInlineBox()

Moves the position to the next InlineLayoutBox.

Declaration

cs-api-definition
public bool MoveToNextInlineBox()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToNextPageStart()

Moves the position to the first position on the next page.

Declaration

cs-api-definition
public void MoveToNextPageStart()

MoveToNextParagraphStart()

Moves the position to the first position in the next paragraph.

Declaration

cs-api-definition
public void MoveToNextParagraphStart()

MoveToNextSpanBox()

Moves the position to the next SpanLayoutBox.

Declaration

cs-api-definition
public bool MoveToNextSpanBox()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToNextWordStart()

Moves the position to the start of the next word.

Declaration

cs-api-definition
public bool MoveToNextWordStart()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToPage(int)

Moves the position to the start of a page.

Declaration

cs-api-definition
public void MoveToPage(int pageNumber)

Parameters

pageNumber

int

The number of the page the position should be moved to.

MoveToParagraphEnd()

Moves the position to the last position in the current paragraph.

Declaration

cs-api-definition
public void MoveToParagraphEnd()

MoveToParagraphStart()

Moves the position to the first position in the current paragraph.

Declaration

cs-api-definition
public void MoveToParagraphStart()

MoveToPosition(DocumentPosition)

Moves the position to a specific position in the document.

Declaration

cs-api-definition
public void MoveToPosition(DocumentPosition newPosition)

Parameters

newPosition

DocumentPosition

The new position.

MoveToPrevious()

Moves the position to the previous possible position in the document.

Declaration

cs-api-definition
public bool MoveToPrevious()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToPreviousInlineBox()

Moves the position to the previous InlineLayoutBox.

Declaration

cs-api-definition
public bool MoveToPreviousInlineBox()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToPreviousPageEnd()

Moves the position to the last position on the previous page.

Declaration

cs-api-definition
public void MoveToPreviousPageEnd()

MoveToPreviousParagraphEnd()

Moves the position to the last position in the previous paragraph.

Declaration

cs-api-definition
public void MoveToPreviousParagraphEnd()

MoveToPreviousParagraphStart()

Moves the position to the first position in the previous paragraph.

Declaration

cs-api-definition
public void MoveToPreviousParagraphStart()

MoveToPreviousSpanBox()

Moves the position to the previous SpanLayoutBox.

Declaration

cs-api-definition
public bool MoveToPreviousSpanBox()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToPreviousWordStart()

Moves the position to the start of the previous word.

Declaration

cs-api-definition
public bool MoveToPreviousWordStart()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveToTableCellEnd()

Moves the position to the last position in the current table cell.

Declaration

cs-api-definition
public void MoveToTableCellEnd()

MoveToTableCellStart()

Moves the position to the first position in the current table cell.

Declaration

cs-api-definition
public void MoveToTableCellStart()

MoveUp()

Moves the position up.

Declaration

cs-api-definition
public bool MoveUp()

Returns

bool

True if the position is moved successfully. Otherwise, false.

MoveVertically(float)

Moves the position vertically with specified offset.

Declaration

cs-api-definition
public void MoveVertically(float verticalOffset)

Parameters

verticalOffset

float

The vertical offset.

OnLocationChanged(bool)

Called after changing the location of the position.

Declaration

cs-api-definition
protected virtual void OnLocationChanged(bool changesCursorInitialLocation)

Parameters

changesCursorInitialLocation

bool

if set to true [changes cursor initial location].

OnLocationChanging()

Called before changing the location of the position.

Declaration

cs-api-definition
protected virtual void OnLocationChanging()

OnPositionChanged()

Called when position is changed.

Declaration

cs-api-definition
protected virtual void OnPositionChanged()

OnPositionChanging()

Called when position is changing.

Declaration

cs-api-definition
protected virtual void OnPositionChanging()

Reset()

Resets the position to the first position in the document.

Declaration

cs-api-definition
public void Reset()

SetPosition(PointF)

Moves the position to the nearest possible to a given point.

Declaration

cs-api-definition
public void SetPosition(PointF point)

Parameters

point

PointF

The point.

ToString()

Returns a string that represents this instance.

Declaration

cs-api-definition
public override string ToString()

Returns

string

A string that represents this instance.

Overrides object.ToString()

Events

LocationChanged

Occurs when changing the coordinates of a position.

For the caret position, this can be also achieved by typing, using the arrows keys or by clicking somewhere in the document.

Declaration

cs-api-definition
public event EventHandler LocationChanged

Event Value

EventHandler

LocationChanging

Occurs before changing the coordinates of a position.

For the caret position, this can be also achieved by typing, using the arrows keys or by clicking somewhere in the document.

Declaration

cs-api-definition
public event EventHandler LocationChanging

Event Value

EventHandler

PositionChanged

Occurs when the position is moved.

For the caret position, this can be also achieved using the arrows keys or by clicking somewhere in the document.

Declaration

cs-api-definition
public event EventHandler PositionChanged

Event Value

EventHandler

PositionChanging

Occurs before the position is moved.

For the caret position, this can be also achieved using the arrows keys or by clicking somewhere in the document.

Declaration

cs-api-definition
public event EventHandler PositionChanging

Event Value

EventHandler

Operators

operator !=(DocumentPosition, DocumentPosition)

Implements the operator !=.

Declaration

cs-api-definition
public static bool operator !=(DocumentPosition position1, DocumentPosition position2)

Parameters

position1

DocumentPosition

The first position.

position2

DocumentPosition

The second position.

Returns

bool

The result of the operator.

operator <(DocumentPosition, DocumentPosition)

Implements the operator <.

Declaration

cs-api-definition
public static bool operator <(DocumentPosition position1, DocumentPosition position2)

Parameters

position1

DocumentPosition

The first position.

position2

DocumentPosition

The second position.

Returns

bool

The result of the operator.

operator <=(DocumentPosition, DocumentPosition)

Implements the operator <=.

Declaration

cs-api-definition
public static bool operator <=(DocumentPosition position1, DocumentPosition position2)

Parameters

position1

DocumentPosition

The first position.

position2

DocumentPosition

The second position.

Returns

bool

The result of the operator.

operator ==(DocumentPosition, DocumentPosition)

Implements the operator ==.

Declaration

cs-api-definition
public static bool operator ==(DocumentPosition position1, DocumentPosition position2)

Parameters

position1

DocumentPosition

The first position.

position2

DocumentPosition

The second position.

Returns

bool

The result of the operator.

operator >(DocumentPosition, DocumentPosition)

Implements the operator >.

Declaration

cs-api-definition
public static bool operator >(DocumentPosition position1, DocumentPosition position2)

Parameters

position1

DocumentPosition

The first position.

position2

DocumentPosition

The second position.

Returns

bool

The result of the operator.

operator >=(DocumentPosition, DocumentPosition)

Implements the operator >=.

Declaration

cs-api-definition
public static bool operator >=(DocumentPosition position1, DocumentPosition position2)

Parameters

position1

DocumentPosition

The first position.

position2

DocumentPosition

The second position.

Returns

bool

The result of the operator.

In this article
DefinitionConstructorsDocumentPosition(DocumentLayoutBox)DocumentPosition(DocumentLayoutBox, bool)DocumentPosition(DocumentPosition)DocumentPosition(DocumentPosition, bool)DocumentPosition(RadDocument)DocumentPosition(RadDocument, bool)PropertiesIsPositionAtDocumentEndIsPositionAtDocumentStartIsPositionAtParagraphEndIsPositionAtParagraphStartIsPositionAtTableCellEndIsPositionAtTableCellStartIsPositionAtTableRowStartIsPositionInsideTableLocationMethodsCompareTo(DocumentPosition)Dispose()Equals(object)GetCurrentInline()GetCurrentInlineBox()GetCurrentParagraph()GetCurrentParagraphBox()GetCurrentSectionBox()GetCurrentSpan()GetCurrentSpanBox()GetCurrentTable()GetCurrentTableBox()GetCurrentTableCell()GetCurrentTableCellBox()GetCurrentTableRow()GetCurrentTableRowBox()GetCurrentWord()GetHashCode()GetIndexInCurrentSpan()GetIndexInCurrentSpanBox()GetNextInline()GetNextInlineBox()GetNextSpanBox()GetPreviousInline()GetPreviousInlineBox()GetPreviousSpanBox()MoveDown()MoveToCurrentLineEnd()MoveToCurrentLineStart()MoveToCurrentWordEnd()MoveToCurrentWordStart()MoveToDocumentElementEnd(DocumentElement)MoveToDocumentElementStart(DocumentElement)MoveToDocumentEnd()MoveToDocumentStart()MoveToInline(Inline)MoveToInline(InlineLayoutBox, int)MoveToNext()MoveToNextInlineBox()MoveToNextPageStart()MoveToNextParagraphStart()MoveToNextSpanBox()MoveToNextWordStart()MoveToPage(int)MoveToParagraphEnd()MoveToParagraphStart()MoveToPosition(DocumentPosition)MoveToPrevious()MoveToPreviousInlineBox()MoveToPreviousPageEnd()MoveToPreviousParagraphEnd()MoveToPreviousParagraphStart()MoveToPreviousSpanBox()MoveToPreviousWordStart()MoveToTableCellEnd()MoveToTableCellStart()MoveUp()MoveVertically(float)OnLocationChanged(bool)OnLocationChanging()OnPositionChanged()OnPositionChanging()Reset()SetPosition(PointF)ToString()EventsLocationChangedLocationChangingPositionChangedPositionChangingOperatorsoperator !=(DocumentPosition, DocumentPosition)operator <(DocumentPosition, DocumentPosition)operator <=(DocumentPosition, DocumentPosition)operator ==(DocumentPosition, DocumentPosition)operator >(DocumentPosition, DocumentPosition)operator >=(DocumentPosition, DocumentPosition)
Not finding the help you need?
Contact Support