Class DocumentPosition
Represents position in RadDocument.
Inheritance
Namespace: Telerik.Windows.Documents
Assembly: Telerik.Windows.Controls.RichTextBox.dll
Syntax
public class DocumentPosition : Object, IComparable<DocumentPosition>, IDisposable
Constructors
DocumentPosition(DocumentPosition)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentPosition documentPosition)
Parameters
DocumentPosition
documentPosition
The document position to copy. |
DocumentPosition(DocumentPosition, Boolean)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentPosition documentPosition, bool trackDocumentChangeEvents)
Parameters
DocumentPosition
documentPosition
The document position to copy. |
System.Boolean
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(DocumentLayoutBox)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentLayoutBox documentBox)
Parameters
DocumentLayoutBox
documentBox
The DocumentLayoutBox of RadDocument. |
DocumentPosition(DocumentLayoutBox, Boolean)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(DocumentLayoutBox documentBox, bool trackDocumentChangeEvents)
Parameters
DocumentLayoutBox
documentBox
The DocumentLayoutBox of RadDocument in which the position will be used. |
System.Boolean
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
RadDocument
document
An instance of RadDocument in which the position will be used. |
DocumentPosition(RadDocument, Boolean)
Initializes a new instance of the DocumentPosition class.
Declaration
public DocumentPosition(RadDocument document, bool trackDocumentChangeEvents)
Parameters
RadDocument
document
An instance of RadDocument in which the position will be used. |
System.Boolean
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.
Declaration
public bool IsPositionAtDocumentEnd { get; }
Property Value
System.Boolean
|
IsPositionAtDocumentStart
Determines whether the DocumentPosition is at the start of the document.
Declaration
public bool IsPositionAtDocumentStart { get; }
Property Value
System.Boolean
|
IsPositionAtParagraphEnd
Determines whether the DocumentPosition is at the end of a Paragraph.
Declaration
public bool IsPositionAtParagraphEnd { get; }
Property Value
System.Boolean
|
IsPositionAtParagraphStart
Determines whether the DocumentPosition is at the start of a Paragraph.
Declaration
public bool IsPositionAtParagraphStart { get; }
Property Value
System.Boolean
|
IsPositionAtTableCellEnd
Determines whether the DocumentPosition is at the end of a TableCell.
Declaration
public bool IsPositionAtTableCellEnd { get; }
Property Value
System.Boolean
|
IsPositionAtTableCellStart
Determines whether the DocumentPosition is at the start of a TableCell.
Declaration
public bool IsPositionAtTableCellStart { get; }
Property Value
System.Boolean
|
IsPositionAtTableRowStart
Determines whether the DocumentPosition is at the start of a TableRow.
Declaration
public bool IsPositionAtTableRowStart { get; }
Property Value
System.Boolean
|
IsPositionInsideTable
Gets a value indicating whether this position is inside table.
Declaration
public bool IsPositionInsideTable { get; }
Property Value
System.Boolean
|
Location
Gets a value representing the layout position of this document position.
Declaration
public PointF Location { get; }
Property Value
PointF
|
Methods
AnchorToCurrentBoxIndex()
Anchors the position to the current box index.
Declaration
public void AnchorToCurrentBoxIndex()
AnchorToNextFormattingSymbol()
Anchors the position to the next formatting symbol.
Declaration
public void AnchorToNextFormattingSymbol()
CompareTo(DocumentPosition)
Compares the current object with another object of the same type.
Declaration
public int CompareTo(DocumentPosition other)
Parameters
DocumentPosition
other
An object to compare with this object. |
Returns
System.Int32
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 |
Dispose()
Disposes this DocumentPosition.
Declaration
public void Dispose()
Equals(Object)
Determines whether the specified System.Object, is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
The System.Object to compare with this instance. |
Returns
System.Boolean
|
FindFirstBoxForWord(InlineLayoutBox)
Finds the first box for word.
Declaration
public static InlineLayoutBox FindFirstBoxForWord(InlineLayoutBox inlineLayoutBox)
Parameters
InlineLayoutBox
inlineLayoutBox
The inline layout box. |
Returns
InlineLayoutBox
|
FindLastBoxForWord(InlineLayoutBox)
Finds the last box for word.
Declaration
public static InlineLayoutBox FindLastBoxForWord(InlineLayoutBox inlineLayoutBox)
Parameters
InlineLayoutBox
inlineLayoutBox
The inline layout box. |
Returns
InlineLayoutBox
|
GetCurrentInline()
Gets the current Inline.
Declaration
public Inline GetCurrentInline()
Returns
Inline
The current Inline element if the position is in an Inline. Otherwise, null. |
GetCurrentInlineBox()
Gets the current InlineLayoutBox.
Declaration
public InlineLayoutBox GetCurrentInlineBox()
Returns
InlineLayoutBox
The current InlineLayoutBox. If such cannot be found, the method returns null. |
GetCurrentParagraph()
Gets the current Paragraph.
Declaration
public Paragraph GetCurrentParagraph()
Returns
Paragraph
The current Paragraph element if the position is in a Paragraph. Otherwise, null. |
GetCurrentParagraphBox()
Gets the current ParagraphLayoutBox.
Declaration
public ParagraphLayoutBox GetCurrentParagraphBox()
Returns
ParagraphLayoutBox
The current ParagraphLayoutBox. If such cannot be found, the method returns null. |
GetCurrentSectionBox()
Gets the current SectionLayoutBox.
Declaration
public SectionLayoutBox GetCurrentSectionBox()
Returns
SectionLayoutBox
The current SectionLayoutBox. If such cannot be found, the method returns null. |
GetCurrentSpan()
Gets the current Span.
Declaration
public Span GetCurrentSpan()
Returns
Span
The current Span element if the position is in a Span. Otherwise, null. |
GetCurrentSpanBox()
Gets the current SpanLayoutBox.
Declaration
public SpanLayoutBox GetCurrentSpanBox()
Returns
SpanLayoutBox
The current SpanLayoutBox. If such cannot be found, the method returns null. |
GetCurrentTable()
Gets the current Table.
Declaration
public Table GetCurrentTable()
Returns
Table
The current Table element if the position is in a Table. Otherwise, null. |
GetCurrentTableBox()
Gets the current TableLayoutBox.
Declaration
public TableLayoutBox GetCurrentTableBox()
Returns
TableLayoutBox
The current TableLayoutBox. If such cannot be found, the method returns null. |
GetCurrentTableCell()
Gets the current TableCell.
Declaration
public TableCell GetCurrentTableCell()
Returns
TableCell
The current TableCell element if the position is in a TableCell. Otherwise, null. |
GetCurrentTableCellBox()
Gets the current TableCellLayoutBox.
Declaration
public TableCellLayoutBox GetCurrentTableCellBox()
Returns
TableCellLayoutBox
The current TableCellLayoutBox. If such cannot be found, the method returns null. |
GetCurrentTableRow()
Gets the current TableRow.
Declaration
public TableRow GetCurrentTableRow()
Returns
TableRow
The current TableRow element if the position is in a TableRow. Otherwise, null. |
GetCurrentTableRowBox()
Gets the current TableRowLayoutBox.
Declaration
public TableRowLayoutBox GetCurrentTableRowBox()
Returns
TableRowLayoutBox
The current TableRowLayoutBox. If such cannot be found, the method returns null. |
GetCurrentWord()
Gets the current word.
Declaration
public string GetCurrentWord()
Returns
System.String
The current word. |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
GetIndexInCurrentSpan()
Gets the index of the position in the current span.
Declaration
public int GetIndexInCurrentSpan()
Returns
System.Int32
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
System.Int32
The index of the position in the current SpanLayoutBox. |
GetNextInline()
Gets the next Inline element.
Declaration
public Inline GetNextInline()
Returns
Inline
The next Inline element. If such cannot be found, the method returns null. |
GetNextInlineBox()
Gets the next InlineLayoutBox.
Declaration
public InlineLayoutBox GetNextInlineBox()
Returns
InlineLayoutBox
The next InlineLayoutBox. If such cannot be found, the method returns null. |
GetNextSpan()
Gets the next SpanLayoutBox.
Declaration
public SpanLayoutBox GetNextSpan()
Returns
SpanLayoutBox
The next SpanLayoutBox. If such cannot be found, the method returns null. |
GetNextSpanBox()
Gets the next SpanLayoutBox.
Declaration
public SpanLayoutBox GetNextSpanBox()
Returns
SpanLayoutBox
The next SpanLayoutBox. If such cannot be found, the method returns null. |
GetPreviousInline()
Gets the previous Inline.
Declaration
public Inline GetPreviousInline()
Returns
Inline
The previous Inline element. If such cannot be found, the method returns null. |
GetPreviousInlineBox()
Gets the previous InlineLayoutBox.
Declaration
public InlineLayoutBox GetPreviousInlineBox()
Returns
InlineLayoutBox
The previous InlineLayoutBox. If such cannot be found, the method returns null. |
GetPreviousSpanBox()
Gets the previous SpanLayoutBox.
Declaration
public SpanLayoutBox GetPreviousSpanBox()
Returns
SpanLayoutBox
The previous SpanLayoutBox. If such cannot be found, the method returns null. |
MoveDown()
Moves the position down.
Declaration
public bool MoveDown()
Returns
System.Boolean
|
MoveToCurrentLineEnd()
Moves the position to the end of the current line.
Declaration
public bool MoveToCurrentLineEnd()
Returns
System.Boolean
|
MoveToCurrentLineStart()
Moves the position to the start of the current line.
Declaration
public bool MoveToCurrentLineStart()
Returns
System.Boolean
|
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
DocumentElement
element
The document element. |
MoveToDocumentElementStart(DocumentElement)
Moves the position to the start of a document element.
Declaration
public void MoveToDocumentElementStart(DocumentElement element)
Parameters
DocumentElement
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()
MoveToEndOfDocumentElement(DocumentElement)
Moves the position to the end of a document element.
Declaration
public void MoveToEndOfDocumentElement(DocumentElement element)
Parameters
DocumentElement
element
The document element. |
MoveToFirstPositionInDocument()
Moves the position to the first position in the document.
Declaration
public void MoveToFirstPositionInDocument()
MoveToFirstPositionInNextParagraph()
Moves the position to the first position in the next paragraph.
Declaration
public void MoveToFirstPositionInNextParagraph()
MoveToFirstPositionInParagraph()
Moves the position to the first position in the current paragraph.
Declaration
public void MoveToFirstPositionInParagraph()
MoveToFirstPositionInPreviousParagraph()
Moves the position to the first position in the previous paragraph.
Declaration
public void MoveToFirstPositionInPreviousParagraph()
MoveToFirstPositionInTableCell()
Moves the position to the first position in the current table cell.
Declaration
public void MoveToFirstPositionInTableCell()
MoveToFirstPositionOnNextPage()
Moves the position to the first position on the next page.
Declaration
public void MoveToFirstPositionOnNextPage()
MoveToInline(InlineLayoutBox, Int32)
Moves the position to InlineLayoutBox.
Declaration
public void MoveToInline(InlineLayoutBox inlineLayoutBox, int index)
Parameters
InlineLayoutBox
inlineLayoutBox
The InlineLayoutBox. |
System.Int32
index
The index in the InlineLayoutBox. |
MoveToInline(Inline)
Moves the position to the start of an Inline.
Declaration
public void MoveToInline(Inline inline)
Parameters
Inline
inline
|
MoveToLastPositionInDocument()
Moves the position to the last position in the document.
Declaration
public void MoveToLastPositionInDocument()
MoveToLastPositionInParagraph()
Moves the position to the last position in the current paragraph.
Declaration
public void MoveToLastPositionInParagraph()
MoveToLastPositionInPreviousParagraph()
Moves the position to the last position in the previous paragraph.
Declaration
public void MoveToLastPositionInPreviousParagraph()
MoveToLastPositionInTableCell()
Moves the position to the last position in the current table cell.
Declaration
public void MoveToLastPositionInTableCell()
MoveToLastPositionOnPreviousPage()
Moves the position to the last position on the previous page.
Declaration
public void MoveToLastPositionOnPreviousPage()
MoveToNext()
Moves the position to the next possible position in the document.
Declaration
public bool MoveToNext()
Returns
System.Boolean
|
MoveToNextInline()
Moves the position to the next InlineLayoutBox.
Declaration
public bool MoveToNextInline()
Returns
System.Boolean
|
MoveToNextInlineBox()
Moves the position to the next InlineLayoutBox.
Declaration
public bool MoveToNextInlineBox()
Returns
System.Boolean
|
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
System.Boolean
|
MoveToNextWordStart()
Moves the position to the start of the next word.
Declaration
public bool MoveToNextWordStart()
Returns
System.Boolean
|
MoveToPage(Int32)
Moves the position to the start of a page.
Declaration
public void MoveToPage(int pageNumber)
Parameters
System.Int32
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
DocumentPosition
newPosition
The new position. |
MoveToPrevious()
Moves the position to the previous possible position in the document.
Declaration
public bool MoveToPrevious()
Returns
System.Boolean
|
MoveToPreviousInline()
Moves the position to the previous InlineLayoutBox.
Declaration
public bool MoveToPreviousInline()
Returns
System.Boolean
|
MoveToPreviousInlineBox()
Moves the position to the previous InlineLayoutBox.
Declaration
public bool MoveToPreviousInlineBox()
Returns
System.Boolean
|
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
System.Boolean
|
MoveToPreviousWordStart()
Moves the position to the start of the previous word.
Declaration
public bool MoveToPreviousWordStart()
Returns
System.Boolean
|
MoveToStartOfDocumentElement(DocumentElement)
Moves the position to the start of a document element.
Declaration
public void MoveToStartOfDocumentElement(DocumentElement element)
Parameters
DocumentElement
element
The document element. |
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
System.Boolean
|
MoveVertically(Single)
Moves the position vertically with specified offset.
Declaration
public void MoveVertically(float verticalOffset)
Parameters
System.Single
verticalOffset
The vertical offset. |
OnLocationChanged(Boolean)
Called after changing the location of the position.
Declaration
protected virtual void OnLocationChanged(bool changesCursorInitialLocation)
Parameters
System.Boolean
changesCursorInitialLocation
if set to |
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()
RemoveAnchorFromNextFormattingSymbol()
Removes the anchor to the next formatting symbol.
Declaration
public void RemoveAnchorFromNextFormattingSymbol()
Reset()
Resets the position to the first position in the document.
Declaration
public void Reset()
RestorePositionFromBoxIndex(Nullable<Boolean>)
Restores the position from the box index.
Declaration
public void RestorePositionFromBoxIndex(Nullable<bool> raiseEvent = null)
Parameters
System.Nullable<System.Boolean>
raiseEvent
|
SetPosition(PointF)
Moves the position to the nearest possible to a given point.
Declaration
public void SetPosition(PointF point)
Parameters
PointF
point
The point. |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
System.String
A System.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.
Declaration
public event EventHandler LocationChanged
Event Type
System.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
public event EventHandler LocationChanging
Event Type
System.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
public event EventHandler PositionChanged
Event Type
System.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
public event EventHandler PositionChanging
Event Type
System.EventHandler
|
Operators
Equality(DocumentPosition, DocumentPosition)
Implements the operator ==.
Declaration
public static bool operator ==(DocumentPosition position1, DocumentPosition position2)
Parameters
DocumentPosition
position1
The first position. |
DocumentPosition
position2
The second position. |
Returns
System.Boolean
The result of the operator. |
GreaterThan(DocumentPosition, DocumentPosition)
Implements the operator >.
Declaration
public static bool operator>(DocumentPosition position1, DocumentPosition position2)
Parameters
DocumentPosition
position1
The first position. |
DocumentPosition
position2
The second position. |
Returns
System.Boolean
The result of the operator. |
GreaterThanOrEqual(DocumentPosition, DocumentPosition)
Implements the operator >=.
Declaration
public static bool operator >=(DocumentPosition position1, DocumentPosition position2)
Parameters
DocumentPosition
position1
The first position. |
DocumentPosition
position2
The second position. |
Returns
System.Boolean
The result of the operator. |
Inequality(DocumentPosition, DocumentPosition)
Implements the operator !=.
Declaration
public static bool operator !=(DocumentPosition position1, DocumentPosition position2)
Parameters
DocumentPosition
position1
The first position. |
DocumentPosition
position2
The second position. |
Returns
System.Boolean
The result of the operator. |
LessThan(DocumentPosition, DocumentPosition)
Implements the operator <.
Declaration
public static bool operator <(DocumentPosition position1, DocumentPosition position2)
Parameters
DocumentPosition
position1
The first position. |
DocumentPosition
position2
The second position. |
Returns
System.Boolean
The result of the operator. |
LessThanOrEqual(DocumentPosition, DocumentPosition)
Implements the operator <=.
Declaration
public static bool operator <=(DocumentPosition position1, DocumentPosition position2)
Parameters
DocumentPosition
position1
The first position. |
DocumentPosition
position2
The second position. |
Returns
System.Boolean
The result of the operator. |