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

Multi-Line Header Texts

1 Answer 99 Views
VirtualGrid
This is a migrated thread and some comments may be shown as answers.
bla
Top achievements
Rank 1
Veteran
bla asked on 26 Aug 2020, 10:32 AM

Can the behaviour of column header cell be changed to the following one?

When there is no space to display the whole header text, the text shall be wrapped so that it spreads over 2 (or more) lines.

 

(Initially now the text is cut off and 3 dots are added at the end.)

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 27 Aug 2020, 12:34 PM

Hello,

In order to customize header cells in RadVirtualGrid, you should use the CellFormatting event. The CellFormatting event is used to add formatting to grid systems cells: header cells, filter cells, and new row cells. Depending on the RowIndex, you can distinguish the system cells. Additional information about formatting cells is available here:
https://docs.telerik.com/devtools/winforms/controls/virtualgrid/cells/formatting-system-cells
https://docs.telerik.com/devtools/winforms/controls/virtualgrid/cells/formatting-data-cells

If you want to wrap the text you can use the TextWrap property as shown below:

 private void RadVirtualGrid1_CellFormatting(object sender, VirtualGridCellElementEventArgs e)
 {
     if (e.CellElement is VirtualGridHeaderCellElement )
     {
         e.CellElement.TextWrap = true;
     }
     else
     {
         e.CellElement.ResetValue(LightVisualElement.TextWrapProperty, ValueResetFlags.Local);
     }
 }

I hope this helps. If you need further assistance please let me know.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
VirtualGrid
Asked by
bla
Top achievements
Rank 1
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or