Lock header row of a details grid

5 posts, 1 answers
  1. Paul
    Paul avatar
    102 posts
    Member since:
    Jun 2010

    Posted 01 Mar 2013 Link to this post

    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.
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 Mar 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Paul
    Paul avatar
    102 posts
    Member since:
    Jun 2010

    Posted 04 Mar 2013 Link to this post

    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.
  5. saji george
    saji george avatar
    1 posts
    Member since:
    Oct 2009

    Posted 22 Mar in reply to Paul Link to this post

    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

  6. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 23 Mar Link to this post

    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 msdn 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.
Back to Top
UI for WPF is Visual Studio 2017 Ready