This is a migrated thread and some comments may be shown as answers.

Rich text box in Grid

8 Answers 66 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jan Paolo
Top achievements
Rank 1
Jan Paolo asked on 14 Mar 2019, 06:13 PM

Hello,

We currently have a requirement for users to be able to bold and insert tabs in a grid's cells.We're currently using `RadGridView` for our grids. We're thinking of using `RadRichTextBox` for the `GridViewDataColumn.DataTemplate` would be a good solution. But the issue is that the height of rows gets expanded because of the rich text box. Is there a way so that the `RadGridView` will look as usual? Please see attached image for reference.

Thank you,

Jan

8 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 19 Mar 2019, 11:28 AM
Hello Jan,

Thank you for the attached pictures. 

In order to limit the Height of the GridViewRows, you can set their Height or MaxHeight property. Here is what I have in mind:
<Style TargetType="telerik:GridViewRow">
            <Setter Property="Height" Value="25" />
</Style>

Note, that if you are using the NoXaml binaries, you will have to base the style on the default one for the theme.

I hope you find helpful. 

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jan Paolo
Top achievements
Rank 1
answered on 19 Mar 2019, 04:16 PM

Hello Vladimir,

Thanks for the answer. I noticed that there are other differences for `RadRichTextBox` and the default `GridViewDataColumn`. Is there any way to make them look very similar? Attached is a sample image comparing the two. Also, the edit cursor doesn't go away in the rich text box.

Thank you!

Jan

 

 

 

0
Jan Paolo
Top achievements
Rank 1
answered on 19 Mar 2019, 08:10 PM
Also, if row is selected, the rich text box covers the highlight. Please see attached image.
0
Vladimir Stoyanov
Telerik team
answered on 21 Mar 2019, 05:16 PM
Hello Jan Paolo,

Thank you for the attached pictures. 

Please, allow me to shed some light on the reason for the differences between the columns. GridViewCells have different controls representing their content depending on whether they are in edit mode or in view mode. In view mode, the default control is a TextBlock and in edit mode - the default control is a TextBox. You can read more about that in the Setting CellTemplate and CellEditTemplate article in our documentation. 

I assume that the different look between the columns comes from the fact that the CellTemplate of the column is set. This way the RadRichTextBox will be used when the cell is in view mode. Instead you can set the CellEditTemplate of the column. This way the RadRichTextBox will be used when the cell is in edit mode. 

On a side note, please note that the RadRichTextBox control contains many additional features and there might be some performance impact when using it in another complex control such as the RadGridView.  With this in mind, you can check if the native RichTextBox control corresponds to your requirements and use it instead. 

I hope you find this helpful. Don't hesitate to contact us again, if you have any other questions.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jan Paolo
Top achievements
Rank 1
answered on 21 Mar 2019, 05:21 PM

Hello Vladimir,

Thank you for the immediate response.

The requirement is to have a table with formatting capabilities (bold, italic, insert tab) so I think the native `RichTextBox` would not suffice. Is there any other way that we can extend `RadGridView` and/or `GridViewDataColumn` to have the said capabilities?

Thank you,

Jan

0
Vladimir Stoyanov
Telerik team
answered on 25 Mar 2019, 03:55 PM
Hello Jan,

Thank you for the update. 

Please, note that the content inside the GridViewCells is represented with a native TextBox when they the cells are in edit mode. With this in mind, you can on extend/replace the TextBox control, for example with the RadRichTextBox as was your original approach. 

If the native RichTextBox does not work for your scenario, may I ask you if you managed to try setting the CellEditTemplate of the corresponding columns to a RadRichTextBox? This way all GridViewColumns should look the same while in view mode. 

I am looking forward to your reply. 

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jan Paolo
Top achievements
Rank 1
answered on 24 Apr 2019, 03:17 PM

Hello Vladimir,

Changing all columns to RadRichTextBox is not desired. We have at least 60 different tables. If we could change the RadRichTextBox to look like the default GridViewDataColumn's editor then I believe our issue will be solved. Thank you.

Jan

0
Vladimir Stoyanov
Telerik team
answered on 25 Apr 2019, 03:40 PM
Hello Jan,

Thank you for the update. 

The default editor for a GridViewCell, which is bound to a string property is the native TextBox control. The RadRichTextBox introduces a lot of additional functionality and in order to do so has many additional elements in its ControlTemplate. With this in mind, it will be difficult to achieve the same look as the normal TextBox.

That said, I posted a reply in the other thread that you have opened: How do I update the Cell edit control?. May I ask you to continue the discussion there in other to avoid duplicating replies?

Thank you in advance for your understanding. 

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Jan Paolo
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Jan Paolo
Top achievements
Rank 1
Share this question
or