Managing Two-Row Headers in GridView with ControlPanel Integration Issues

1 Answer 43 Views
GridView
Christofer
Top achievements
Rank 1
Christofer asked on 07 Aug 2024, 10:36 AM

I have a GridView with a few rows that have longer headers than I need. To address this, I implemented two-row headers, as shown in one of the screenshots. However, I am using a ControlPanel for a few settings, one of which is hiding and revealing columns in my GridView. This feature doesn't work properly with my two-row headers, as seen in the screenshots.

Initially, when I open the ControlPanel, all two-row headers disappear, leaving empty headers. When I hide a column with a two-row header, the name of the column (header) disappears from the ControlPanel, but the checkbox remains, as shown in the screenshots. When I reveal the column again, the header reappears.

My question is: How should I manage headers when I want them to be two-row?

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 12 Aug 2024, 09:26 AM

Hello Christofer,

The observed behavior is expected due to the Binding instance that is created for the Content property of the CheckBox element (in the ControlPanelItem element) and the Header property of the column is set as a Path. However, the Header property is set to a TextBlock, which is a visual element. Since a visual element cannot be present in more than one place, it is removed from the header cell and added to the checkbox.

With this in mind, what I can suggest would be to define the columns' headers in the view model of the RadGridView, for example, as auto-calculated properties, and bind them to the Header property of each column.

I have prepared a sample project for you to test, which contains the above suggestion's implementation.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Christofer
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or