ClassDocumentSelection
Represents a selection in a RadDocument.
Definition
Namespace:Telerik.Windows.Documents.Selection
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public class DocumentSelection
Inheritance: objectDocumentSelection
Constructors
DocumentSelection(RadDocument)
Creates an instance of the DocumentSelection class.
Declaration
public DocumentSelection(RadDocument document)
Parameters
document
A RadDocument instance which the selection will be associated to.
Properties
IsEmpty
Gets a value determining whether the selection is empty.
Ranges
Gets a collection of all SelectionRange instances in the selection.
Declaration
public SelectionRangeCollection Ranges { get; }
Property Value
Methods
AddDocumentElementToSelection(DocumentElement)
Adds a specified document element to the existing selection.
Declaration
public void AddDocumentElementToSelection(DocumentElement documentElement)
Parameters
documentElement
The document element that should be added to the selection.
AddParagraphToSelection(Paragraph)
Adds a paragraph to the existing selection.
Declaration
public void AddParagraphToSelection(Paragraph paragraph)
Parameters
paragraph
The paragraph that should be added to the selection.
AddSelectionEnd(DocumentPosition)
Finishes the started SelectionRange by setting its end at the specified position.
This method finishes a range started using AddSelectionStart(DocumentPosition) or SetSelectionStart(DocumentPosition).
Declaration
public void AddSelectionEnd(DocumentPosition position)
Parameters
position
The end position.
AddSelectionStart(DocumentPosition)
Begins a new SelectionRange starting at the specified position.
This method starts the creation of a range, which should be finished with AddSelectionEnd(DocumentPosition).
Declaration
public void AddSelectionStart(DocumentPosition position)
Parameters
position
The start position.
AddTableCellToSelection(TableCell)
Adds a table cell to the existing selection.
Declaration
public void AddTableCellToSelection(TableCell tableCell)
Parameters
tableCell
The cell that should be added to the selection.
ContainsAnnotationMarkersOfType<T>()
Determines whether the selection contains annotation markers of type T.
Declaration
public bool ContainsAnnotationMarkersOfType<T>() where T : AnnotationMarkerBase
Returns
True if the selection contains annotation markers of the specified type. Otherwise, false.
CopySelectedDocumentElements(bool)
Copies all selected document elements to a DocumentFragment instance.
Declaration
public DocumentFragment CopySelectedDocumentElements(bool expandPartialRevisionRanges = false)
Parameters
expandPartialRevisionRanges
Determines whether the partially selected revision ranges should be preserved by creating pairs for them.
Returns
A DocumentFragment object containing the copied elements.
CreateDocumentFromSelection(bool)
Creates a new document from the selected elements.
Declaration
public RadDocument CreateDocumentFromSelection(bool replaceFieldsWithResults = false)
Parameters
replaceFieldsWithResults
Determines whether the fields in the selection should be replaced with their result values.
Returns
A RadDocument instance containing the elements from the selection.
GetAnnotationMarkersOfType<T>()
Gets all annotation markers of type T in the selection.
Declaration
public IEnumerable<T> GetAnnotationMarkersOfType<T>() where T : AnnotationMarkerBase
Returns
IEnumerable<T>
A collection containing the annotation markers of type T in the selection.
GetFullSelectionGeometry()
Gets a Geometry instance describing the form of the selection.
Declaration
public Geometry GetFullSelectionGeometry()
Returns
Geometry
A Geometry instance describing the form of the selection.
GetSelectedBoxes()
Enumerates through all inline layout boxes included in the selected ranges.
Declaration
public IEnumerable<InlineLayoutBox> GetSelectedBoxes()
Returns
A collection of inline layout boxes.
GetSelectedBoxes<T>()
Enumerates through all inline layout boxes of type T included in the selected ranges.
Declaration
public IEnumerable<T> GetSelectedBoxes<T>() where T : InlineLayoutBox
Returns
IEnumerable<T>
A collection of inline layout boxes of type T.
GetSelectedParagraphs()
Gets the paragraphs included in the selection.
Declaration
public IEnumerable<Paragraph> GetSelectedParagraphs()
Returns
A collection containing the paragraphs in the selection.
GetSelectedSingleInline()
Gets the selected Inline if it is the only inline selected, otherwise returns null.
For example, it is suitable to check if only a ImageInline is selected.
Declaration
public Inline GetSelectedSingleInline()
Returns
Returns the selected Inline if it is the only inline selected, otherwise returns null.
GetSelectedSingleShape()
Gets the selected shape inline if it is the only inline selected, otherwise returns null.
GetSelectedText()
Gets the selected text.
Declaration
public string GetSelectedText()
Returns
The text of the selection.
GetSelectedText(bool)
Gets the selected text.
GetVisibleSelectionGeometry(RectangleF)
Gets a Geometry instance describing the form of the selection visible in the visibleRectangle.
Declaration
public Geometry GetVisibleSelectionGeometry(RectangleF visibleRectangle)
Parameters
visibleRectangle
The rectangle used to clip the selection.
Returns
Geometry
A Geometry instance describing the form of the selection.
OnSelectionChanged()
Called after the selection is changed.
Declaration
protected virtual void OnSelectionChanged()
OnSelectionChanging()
Called before the selection is changed.
Declaration
protected virtual void OnSelectionChanging()
SelectAll()
Selects all elements in the document.
Declaration
public void SelectAll()
SelectAnnotationRange(AnnotationRangeStart)
Selects annotation range including the AnnotationRangeStart and AnnotationRangeEnd elements.
Declaration
public void SelectAnnotationRange(AnnotationRangeStart annotationStart)
Parameters
annotationStart
The AnnotationRangeStart of the annotation.
SelectTableColumn(Table, int)
Creates a new selection containing all the cells at a specified table grid column index.
The table grid is the set of grid columns which define all of the shared vertical edges of the table.
SelectTableColumn(TableCell)
Creates a new selection containing all the cells at the table grid column index of the specified table cell.
Declaration
public void SelectTableColumn(TableCell tableCell)
Parameters
tableCell
A cell from the column that should be selected.
SelectTableRow(TableRow)
Creates a new selection containing the specific table row.
Declaration
public void SelectTableRow(TableRow tableRow)
Parameters
tableRow
The table row that should be selected.
SetSelectionStart(DocumentPosition)
Empties the selection and begins a new SelectionRange starting at the specified position.
This method starts the creation of a range, which should be finished with AddSelectionEnd(DocumentPosition).
Declaration
public void SetSelectionStart(DocumentPosition position)
Parameters
position
The start position.
ToString()
Gets the text from the selected document elements.
Declaration
public override string ToString()
Returns
A string containing the text in the selection.
Overrides
Events
SelectionChanged
Occurs after the selection is changed.
SelectionChanging
Occurs before the selection is changed.