0

So, I need a WPF RichTextBox control with support for table creation (beside usual formatting stuff, hyperlinks and support for html format). Just to clarify I need the user to be able to insert table rows & columns.

The Xceed RichTextBox control from "Extended WPF Toolkit" is actually great (beside being free and open-source) except that it doesn't have the tables functionality out of the box.

I am just wondering what is the best approach to add table functionality to the control? Has anyone done this before?

Probably the answer is you just add the logic and the UI :) - similar to TinyMCE. I just wanted to know if somebody already done this and made it open-source.

Valentin
  • 717
  • 10
  • 21
  • What do you mean by the `Table` functionality? Just to have ability to create rows and columns inside of the `RichTextBox`? Or do you need also ability to customize that table borders? – XAMlMAX Jun 06 '17 at 08:45
  • I need the user just to be able to create table rows & columns. Edited question. – Valentin Jun 06 '17 at 12:40

1 Answers1

0

Try to bind the Text property of the RichTextBox to a RTF string that defines the table structure:

Using Tables in RTF

...and set the TextFormatter property to a RtfFormatter:

<toolkit:RichTextBox x:Name="_richTextBox" Margin="10" BorderBrush="Gray" Padding="10"
                     Text="{Binding YourRtfSourceProperty}" ScrollViewer.VerticalScrollBarVisibility="Auto">
    <toolkit:RichTextBox.TextFormatter>
        <toolkit:RtfFormatter />
    </toolkit:RichTextBox.TextFormatter>
</toolkit:RichTextBox>
mm8
  • 163,881
  • 10
  • 57
  • 88
  • That's good info but I am more concerned about is how to make the UI part. Or is it that I just need to add some event handlers calling your code for some buttons like insert/delete row/column? Btw I need it for html but more concerned how to connect the RichTextBox with the behind the scenes stuff. – Valentin Jun 06 '17 at 12:48