ClassDocumentPosition
Represents position in RadDocument.
Definition
Namespace:Telerik.Windows.Documents
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public class DocumentPosition : IComparable<DocumentPosition>, IDisposable
Inheritance: objectDocumentPosition
Implements:
Constructors
DocumentPosition(DocumentLayoutBox)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentLayoutBox documentBox)
Parameters
documentBox
The DocumentLayoutBox of RadDocument.
DocumentPosition(DocumentLayoutBox, bool)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentLayoutBox documentBox, bool trackDocumentChangeEvents)
Parameters
documentBox
The DocumentLayoutBox of RadDocument in which the position will be used.
trackDocumentChangeEvents
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
public DocumentPosition(DocumentPosition documentPosition)
Parameters
documentPosition
The document position to copy.
DocumentPosition(DocumentPosition, bool)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentPosition documentPosition, bool trackDocumentChangeEvents)
Parameters
documentPosition
The document position to copy.
trackDocumentChangeEvents
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
public DocumentPosition(RadDocument document)
Parameters
document
An instance of RadDocument in which the position will be used.
DocumentPosition(RadDocument, bool)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(RadDocument document, bool trackDocumentChangeEvents)
Parameters
document
An instance of RadDocument in which the position will be used.
trackDocumentChangeEvents
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.
IsPositionAtDocumentStart
Determines whether the DocumentPosition is at the start of the document.
IsPositionAtParagraphEnd
Determines whether the DocumentPosition is at the end of a Paragraph.
IsPositionAtParagraphStart
Determines whether the DocumentPosition is at the start of a Paragraph.
IsPositionAtTableCellEnd
Determines whether the DocumentPosition is at the end of a TableCell.
IsPositionAtTableCellStart
Determines whether the DocumentPosition is at the start of a TableCell.
IsPositionAtTableRowStart
Determines whether the DocumentPosition is at the start of a TableRow.
IsPositionInsideTable
Gets a value indicating whether this position is inside table.
Declaration
public bool IsPositionInsideTable { get; }
Property Value
true if this position is inside table; otherwise, false.
Methods
CompareTo(DocumentPosition)
Compares the current object with another object of the same type.
Declaration
public int CompareTo(DocumentPosition other)
Parameters
other
An object to compare with this object.
Returns
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
Dispose()
Disposes this DocumentPosition.
Declaration
public void Dispose()
Implements
Equals(object)
Determines whether the specified object, is equal to this instance.
GetCurrentInline()
Gets the current Inline.
GetCurrentInlineBox()
Gets the current InlineLayoutBox.
Declaration
public InlineLayoutBox GetCurrentInlineBox()
Returns
The current InlineLayoutBox. If such cannot be found, the method returns null.
GetCurrentParagraph()
Gets the current Paragraph.
GetCurrentParagraphBox()
Gets the current ParagraphLayoutBox.
Declaration
public ParagraphLayoutBox GetCurrentParagraphBox()
Returns
The current ParagraphLayoutBox. If such cannot be found, the method returns null.
GetCurrentSectionBox()
Gets the current SectionLayoutBox.
Declaration
public SectionLayoutBox GetCurrentSectionBox()
Returns
The current SectionLayoutBox. If such cannot be found, the method returns null.
GetCurrentSpan()
Gets the current Span.
GetCurrentSpanBox()
Gets the current SpanLayoutBox.
Declaration
public SpanLayoutBox GetCurrentSpanBox()
Returns
The current SpanLayoutBox. If such cannot be found, the method returns null.
GetCurrentTable()
Gets the current Table.
GetCurrentTableBox()
Gets the current TableLayoutBox.
Declaration
public TableLayoutBox GetCurrentTableBox()
Returns
The current TableLayoutBox. If such cannot be found, the method returns null.
GetCurrentTableCell()
Gets the current TableCell.
GetCurrentTableCellBox()
Gets the current TableCellLayoutBox.
Declaration
public TableCellLayoutBox GetCurrentTableCellBox()
Returns
The current TableCellLayoutBox. If such cannot be found, the method returns null.
GetCurrentTableRow()
Gets the current TableRow.
GetCurrentTableRowBox()
Gets the current TableRowLayoutBox.
Declaration
public TableRowLayoutBox GetCurrentTableRowBox()
Returns
The current TableRowLayoutBox. If such cannot be found, the method returns null.
GetCurrentWord()
Gets the current word.
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Overrides
GetIndexInCurrentSpan()
Gets the index of the position in the current span.
Declaration
public int GetIndexInCurrentSpan()
Returns
The index of the position in the current span.
GetIndexInCurrentSpanBox()
Gets the index of the position in the current SpanLayoutBox.
Declaration
public int GetIndexInCurrentSpanBox()
Returns
The index of the position in the current SpanLayoutBox.
GetNextInline()
Gets the next Inline element.
GetNextInlineBox()
Gets the next InlineLayoutBox.
Declaration
public InlineLayoutBox GetNextInlineBox()
Returns
The next InlineLayoutBox. If such cannot be found, the method returns null.
GetNextSpanBox()
Gets the next SpanLayoutBox.
Declaration
public SpanLayoutBox GetNextSpanBox()
Returns
The next SpanLayoutBox. If such cannot be found, the method returns null.
GetPreviousInline()
Gets the previous Inline.
GetPreviousInlineBox()
Gets the previous InlineLayoutBox.
Declaration
public InlineLayoutBox GetPreviousInlineBox()
Returns
The previous InlineLayoutBox. If such cannot be found, the method returns null.
GetPreviousSpanBox()
Gets the previous SpanLayoutBox.
Declaration
public SpanLayoutBox GetPreviousSpanBox()
Returns
The previous SpanLayoutBox. If such cannot be found, the method returns null.
MoveDown()
Moves the position down.
Declaration
public bool MoveDown()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToCurrentLineEnd()
Moves the position to the end of the current line.
Declaration
public bool MoveToCurrentLineEnd()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToCurrentLineStart()
Moves the position to the start of the current line.
Declaration
public bool MoveToCurrentLineStart()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToCurrentWordEnd()
Moves the position to the end of the current word.
Declaration
public void MoveToCurrentWordEnd()
MoveToCurrentWordStart()
Moves the position to the start of the current word.
Declaration
public void MoveToCurrentWordStart()
MoveToDocumentElementEnd(DocumentElement)
Moves the position to the end of a document element.
Declaration
public void MoveToDocumentElementEnd(DocumentElement element)
Parameters
element
The document element.
MoveToDocumentElementStart(DocumentElement)
Moves the position to the start of a document element.
Declaration
public void MoveToDocumentElementStart(DocumentElement element)
Parameters
element
The document element.
MoveToDocumentEnd()
Moves the position to the last position in the document.
Declaration
public void MoveToDocumentEnd()
MoveToDocumentStart()
Moves the position to the first position in the document.
Declaration
public void MoveToDocumentStart()
MoveToInline(Inline)
Moves the position to the start of an Inline.
MoveToInline(InlineLayoutBox, int)
Moves the position to InlineLayoutBox.
Declaration
public void MoveToInline(InlineLayoutBox inlineLayoutBox, int index)
Parameters
inlineLayoutBox
The InlineLayoutBox.
index
The index in the InlineLayoutBox.
MoveToNext()
Moves the position to the next possible position in the document.
Declaration
public bool MoveToNext()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToNextInlineBox()
Moves the position to the next InlineLayoutBox.
Declaration
public bool MoveToNextInlineBox()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToNextPageStart()
Moves the position to the first position on the next page.
Declaration
public void MoveToNextPageStart()
MoveToNextParagraphStart()
Moves the position to the first position in the next paragraph.
Declaration
public void MoveToNextParagraphStart()
MoveToNextSpanBox()
Moves the position to the next SpanLayoutBox.
Declaration
public bool MoveToNextSpanBox()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToNextWordStart()
Moves the position to the start of the next word.
Declaration
public bool MoveToNextWordStart()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToPage(int)
Moves the position to the start of a page.
Declaration
public void MoveToPage(int pageNumber)
Parameters
pageNumber
The number of the page the position should be moved to.
MoveToParagraphEnd()
Moves the position to the last position in the current paragraph.
Declaration
public void MoveToParagraphEnd()
MoveToParagraphStart()
Moves the position to the first position in the current paragraph.
Declaration
public void MoveToParagraphStart()
MoveToPosition(DocumentPosition)
Moves the position to a specific position in the document.
Declaration
public void MoveToPosition(DocumentPosition newPosition)
Parameters
newPosition
The new position.
MoveToPrevious()
Moves the position to the previous possible position in the document.
Declaration
public bool MoveToPrevious()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToPreviousInlineBox()
Moves the position to the previous InlineLayoutBox.
Declaration
public bool MoveToPreviousInlineBox()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToPreviousPageEnd()
Moves the position to the last position on the previous page.
Declaration
public void MoveToPreviousPageEnd()
MoveToPreviousParagraphEnd()
Moves the position to the last position in the previous paragraph.
Declaration
public void MoveToPreviousParagraphEnd()
MoveToPreviousParagraphStart()
Moves the position to the first position in the previous paragraph.
Declaration
public void MoveToPreviousParagraphStart()
MoveToPreviousSpanBox()
Moves the position to the previous SpanLayoutBox.
Declaration
public bool MoveToPreviousSpanBox()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToPreviousWordStart()
Moves the position to the start of the previous word.
Declaration
public bool MoveToPreviousWordStart()
Returns
True if the position is moved successfully. Otherwise, false.
MoveToTableCellEnd()
Moves the position to the last position in the current table cell.
Declaration
public void MoveToTableCellEnd()
MoveToTableCellStart()
Moves the position to the first position in the current table cell.
Declaration
public void MoveToTableCellStart()
MoveUp()
Moves the position up.
Declaration
public bool MoveUp()
Returns
True if the position is moved successfully. Otherwise, false.
MoveVertically(float)
Moves the position vertically with specified offset.
Declaration
public void MoveVertically(float verticalOffset)
Parameters
verticalOffset
The vertical offset.
OnLocationChanged(bool)
Called after changing the location of the position.
Declaration
protected virtual void OnLocationChanged(bool changesCursorInitialLocation)
Parameters
changesCursorInitialLocation
if set to true [changes cursor initial location].
OnLocationChanging()
Called before changing the location of the position.
Declaration
protected virtual void OnLocationChanging()
OnPositionChanged()
Called when position is changed.
Declaration
protected virtual void OnPositionChanged()
OnPositionChanging()
Called when position is changing.
Declaration
protected virtual void OnPositionChanging()
Reset()
Resets the position to the first position in the document.
Declaration
public void Reset()
SetPosition(PointF)
Moves the position to the nearest possible to a given point.
Declaration
public void SetPosition(PointF point)
Parameters
point
The point.
ToString()
Returns a string that represents this instance.
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.
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.
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.
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.
Operators
operator !=(DocumentPosition, DocumentPosition)
Implements the operator !=.
Declaration
public static bool operator !=(DocumentPosition position1, DocumentPosition position2)
Parameters
position1
The first position.
position2
The second position.
Returns
The result of the operator.
operator <(DocumentPosition, DocumentPosition)
Implements the operator <.
Declaration
public static bool operator <(DocumentPosition position1, DocumentPosition position2)
Parameters
position1
The first position.
position2
The second position.
Returns
The result of the operator.
operator <=(DocumentPosition, DocumentPosition)
Implements the operator <=.
Declaration
public static bool operator <=(DocumentPosition position1, DocumentPosition position2)
Parameters
position1
The first position.
position2
The second position.
Returns
The result of the operator.
operator ==(DocumentPosition, DocumentPosition)
Implements the operator ==.
Declaration
public static bool operator ==(DocumentPosition position1, DocumentPosition position2)
Parameters
position1
The first position.
position2
The second position.
Returns
The result of the operator.
operator >(DocumentPosition, DocumentPosition)
Implements the operator >.
Declaration
public static bool operator >(DocumentPosition position1, DocumentPosition position2)
Parameters
position1
The first position.
position2
The second position.
Returns
The result of the operator.
operator >=(DocumentPosition, DocumentPosition)
Implements the operator >=.
Declaration
public static bool operator >=(DocumentPosition position1, DocumentPosition position2)
Parameters
position1
The first position.
position2
The second position.
Returns
The result of the operator.