Home Forums WPF controls Xceed DataGrid for WPF RTF in Xceed DataGrid for WPF

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #27063 |

    Hi guys,

    I need to make the certain column in the grid to be rich text formatted column. It means that I have table with text field. Values of the field is RTF text. So I want to get the text formatted in the grid.

    The only way to do that as I have understood is to set to CellContentTemplate column property template with RichTextBox:


    DataTemplate template = new DataTemplate( typeof( RichTextBox ) );

    template.VisualTree = control;

    _grid.Columns[ 0 ].CellContentTemplate = template;


    But I have 2 problems here:

    1. How can I customize the RichTextBox properties before I give it to CellContetTemplate? (for ex. make its border style none)

    2. How can make the RichTextBox in the grid cell to show cell text? As I understand I should bind the Content of RichTextBox to cell text…

    Would anybody provide me a code sample how to do it?

     Thanks a lot

    Imported from legacy forums. Posted by Aleksey (had 911 views)

    Xceed Support
    Post count: 5658

    You need to use a CellEditorBinding in order to bind the content of the RichTextBox to the cell’s; however, if you want to use the WPF RichTextBox, you might be in for a surprise as it is not like the WinForms one and can’t be easily bound to.

    For example, in the WPF RTB, there is no Text property to which you can bind but rather a Document property, which exposes a FlowDocument an that is not bindable. You would need to create a “BindableFlowDocument” as demonstrated here and then bind to that property using the CellEditorBinding.


    Imported from legacy forums. Posted by Jenny [Xceed] (had 1676 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.