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

Lock header row of a details grid

4 Answers 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 01 Mar 2013, 10:07 PM
I am guessing this isn't possible, but I'll be quite impressed if it is!

I have a RadGridView.  It opens with the rows in a collapsed state so that the details are hidden and you only see a single 'summary' line.  When you expand the row, the row details template contains a separate RadGridView which displays all details.  There are no scrollbars in the second grid.  The users scroll the main grid down which of course hides the detail grid header row.

Two possibilities:
1) Somehow make this row a fixed row, but in the scope of the parent grid (I am guessing not gonna happen? Maybe?)
2) Add scrollbars to the second grid, and make the users use two scroll bars.

I don't like option #2 because users would have trouble with two scrollbars.  Also, I can't figure out how to tell what size I should limit the child grid to.

4 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 04 Mar 2013, 11:12 AM
Hello Paul,

Currently, the first option is not possible. Considering the second one, the reason that you do not see a scroll bar for the inner grid is that the element in the row details is measured with infinity - that is why the grid takes all the space it needs. What you can try is to set the Width of the child grid or synchronize it with the one of the parent (an example for the latest approach can be found here).

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Paul
Top achievements
Rank 1
answered on 04 Mar 2013, 03:24 PM
If anyone else runs into this, I ended up using a binding and a converter.  I created a converter that would take a value and convert it to a double.  Then it takes the parameter and converts it to a double.  Then it subtracts the two and returns the result.

Then in the details template for the RadGridView, I added the following:

MaxHeight="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadGridView}, 
                                  Path=ActualHeight, 
                                  Converter={StaticResource cnvDoubleSubtractionKey}, 
                                  ConverterParameter=72}"
MaxWidth="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadGridView}, 
                                 Path=ActualWidth, 
                                 Converter={StaticResource cnvDoubleSubtractionKey}, 
                                 ConverterParameter=50}">

The 72/50 were just guesses on my part based on the sizes of the header row of the main grid, and the scrollbars.  

It works just fine using this.
0
saji george
Top achievements
Rank 1
answered on 22 Mar 2016, 06:26 AM

HI Paul,

Could you please give the complete to code to achieve this one. I have similar requirement in RadGridView Scrolling and Lock Header as well. Please give the exact code to converter and WPF. That would be grateful.

Thanks

Saji

0
Maya
Telerik team
answered on 23 Mar 2016, 07:49 AM
Hello Saji,

Based on the information provided by Paul, my guess would be that the idea is to work with IValueConverter and perform the calculations inside. More information about converter can be found in the corresponding article.

Regards,
Maya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Maya
Telerik team
Paul
Top achievements
Rank 1
saji george
Top achievements
Rank 1
Share this question
or