New to Telerik UI for WPFStart a free 30-day trial

Getting a List of All Tables in the Current Selection

Updated on Sep 15, 2025

Environment

ProductVersion
RadRichTextBox for WPF2023.3.1010

Description

How to retrieve a list of all tables in the current selection in RadRichTextBox.

Solution

  1. Create a copy of the selection as a new RadDocument using the CreateDocumentFromSelection method of the document's selection.

  2. 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();
     }
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support