New to Telerik UI for WPF? Start a free 30-day trial
Getting a List of All Tables in the Current Selection
Updated on Sep 15, 2025
Environment
| Product | Version |
|---|---|
| RadRichTextBox for WPF | 2023.3.1010 |
Description
How to retrieve a list of all tables in the current selection in RadRichTextBox.
Solution
-
Create a copy of the selection as a new RadDocument using the
CreateDocumentFromSelectionmethod of the document's selection. -
Iterate through the document and check for Table objects.
Here's an example implementation:
C#
public List<Table> GetTablesInSelection()
{
var documentFromSelection = this.richTextBox.Document.Selection.CreateDocumentFromSelection();
return documentFromSelection.EnumerateChildrenOfType<Table>().ToList();
}