Class DocumentSelection
Represents a selection in a RadDocument.
Inheritance
Namespace: Telerik.Windows.Documents.Selection
Assembly: Telerik.Windows.Documents.dll
Syntax
public class DocumentSelection : Object
Constructors
DocumentSelection(RadDocument)
Creates an instance of the DocumentSelection class.
Declaration
public DocumentSelection(RadDocument document)
Parameters
RadDocument
document
A RadDocument instance which the selection will be associated to. |
Properties
CanGetSelectedBoxes
Gets a value indicating whether the selected boxes can be enumerated correctly.
Declaration
public bool CanGetSelectedBoxes { get; }
Property Value
System.Boolean
|
IsEmpty
Gets a value determining whether the selection is empty.
Declaration
public bool IsEmpty { get; }
Property Value
System.Boolean
|
Ranges
Gets a collection of all SelectionRange instances in the selection.
Declaration
public SelectionRangeCollection Ranges { get; }
Property Value
SelectionRangeCollection
|
Methods
AddDocumentElementToSelection(DocumentElement)
Adds a specified document element to the existing selection.
Declaration
public void AddDocumentElementToSelection(DocumentElement documentElement)
Parameters
DocumentElement
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
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
DocumentPosition
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
DocumentPosition
position
The start position. |
AddTableCellToSelection(TableCell)
Adds a table cell to the existing selection.
Declaration
public void AddTableCellToSelection(TableCell tableCell)
Parameters
TableCell
tableCell
The cell that should be added to the selection. |
AnchorSelectionPositions()
Declaration
public void AnchorSelectionPositions()
BeginUpdate()
Declaration
public void BeginUpdate()
BeginUpdate(Boolean)
Declaration
public void BeginUpdate(bool notifyChanges)
Parameters
System.Boolean
notifyChanges
|
Clear()
Clears the selection.
Declaration
public void Clear()
ContainsAnnotationMarkersOfType<T>()
Determines whether the selection contains annotation markers of type T.
Declaration
public bool ContainsAnnotationMarkersOfType<T>()
where T : AnnotationMarkerBase
Returns
System.Boolean
|
Type Parameters
T
|
CopySelectedDocumentElements(Boolean)
Copies all selected document elements to a DocumentFragment instance.
Declaration
public DocumentFragment CopySelectedDocumentElements(bool expandPartialRevisionRanges = false)
Parameters
System.Boolean
expandPartialRevisionRanges
Determines whether the partially selected revision ranges should be preserved by creating pairs for them. |
Returns
DocumentFragment
A DocumentFragment object containing the copied elements. |
CopySelectedDocumentElements(SelectionRange)
Declaration
public static DocumentFragment CopySelectedDocumentElements(SelectionRange range)
Parameters
SelectionRange
range
|
Returns
DocumentFragment
|
CreateDocumentFromSelection(Boolean)
Creates a new document from the selected elements.
Declaration
public RadDocument CreateDocumentFromSelection(bool replaceFieldsWithResults = false)
Parameters
System.Boolean
replaceFieldsWithResults
Determines whether the fields in the selection should be replaced with their result values. |
Returns
RadDocument
A RadDocument instance containing the elements from the selection. |
EndUpdate()
Declaration
public void EndUpdate()
EndUpdate(Boolean)
Declaration
public void EndUpdate(bool notifyChanged)
Parameters
System.Boolean
notifyChanged
|
GetAnnotationMarkersOfType<T>()
Gets all annotation markers of type T in the selection.
Declaration
public IEnumerable<T> GetAnnotationMarkersOfType<T>()
where T : AnnotationMarkerBase
Returns
System.Collections.Generic.IEnumerable<T>
A collection containing the annotation markers of type T in the selection. |
Type Parameters
T
|
GetFullSelectionGeometry()
Gets a System.Windows.Media.Geometry instance describing the form of the selection.
Declaration
public Geometry GetFullSelectionGeometry()
Returns
System.Windows.Media.Geometry
A System.Windows.Media.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
System.Collections.Generic.IEnumerable<InlineLayoutBox>
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
System.Collections.Generic.IEnumerable<T>
A collection of inline layout boxes of type |
Type Parameters
T
|
GetSelectedParagraphs()
Gets the paragraphs included in the selection.
Declaration
public IEnumerable<Paragraph> GetSelectedParagraphs()
Returns
System.Collections.Generic.IEnumerable<Paragraph>
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
Inline
Returns the selected Inline if it is the only inline selected, otherwise returns |
GetSelectedText()
Gets the selected text.
Declaration
public string GetSelectedText()
Returns
System.String
The text of the selection. |
GetSelectedText(Boolean)
Gets the selected text.
Declaration
public string GetSelectedText(bool includeListsText)
Parameters
System.Boolean
includeListsText
If set to |
Returns
System.String
The text of the selection. |
GetVisibleSelectionGeometry(RectangleF)
Gets a System.Windows.Media.Geometry instance describing the form of the selection visible in the visibleRectangle
.
Declaration
public Geometry GetVisibleSelectionGeometry(RectangleF visibleRectangle)
Parameters
RectangleF
visibleRectangle
The rectangle used to clip the selection. |
Returns
System.Windows.Media.Geometry
A System.Windows.Media.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()
RemoveSelectionPositionsAnchor()
Declaration
public void RemoveSelectionPositionsAnchor()
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
AnnotationRangeStart
annotationStart
The AnnotationRangeStart of the annotation. |
SelectTableColumn(Table, Int32)
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.
Declaration
public void SelectTableColumn(Table table, int gridColumnIndex)
Parameters
Table
table
The table containing the column that should be selected. |
System.Int32
gridColumnIndex
The index of the table grid column that should be selected. |
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
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
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
DocumentPosition
position
The start position. |
ToString()
Gets the text from the selected document elements.
Declaration
public override string ToString()
Returns
System.String
A |
Events
SelectionChanged
Occurs after the selection is changed.
Declaration
public event EventHandler SelectionChanged
Event Type
System.EventHandler
|
SelectionChanging
Occurs before the selection is changed.
Declaration
public event EventHandler SelectionChanging
Event Type
System.EventHandler
|