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