Detail GridView Frozen Column still scrolling when master Gridview scrolls

5 posts, 0 answers
  1. Scott
    Scott avatar
    12 posts
    Member since:
    Jun 2014

    Posted 17 May Link to this post

    Hello,

    I have a master GridView and a details GridView in a RowDetailsTemplate. The master GridView is set to use FrozenColumnCount and works when the master GridView is scrolled horizontally as I expected, meaning the specified columns do not scroll.

    The detail GridView is also set to use FrozenColumnCount. But when I scroll at the master GridView level, the frozen columns in the detail GridView scroll anyway.

    Is there a way to scroll at the master GridView level, and have the detail GridView respect the FrozenColumnCount setting?

    Any suggestions?

    Thanks in advance!

    Scott

  2. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 19 May Link to this post

    Hello Scott,

    Such kind of functionality isn't available because the master grid detects the content defined within its RowDetailsTemplate not like a grid, but just as a content control. Therefore, there is no way for the master grid to respect the detail's grid FrozenColumnCount setting.

    Regards,
    Martin Vatev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Scott
    Scott avatar
    12 posts
    Member since:
    Jun 2014

    Posted 24 May in reply to Martin Vatev Link to this post

    Hello,

    I understand the content control vs grid issue. I wonder if there is a workaround along another line:

    1 - set details AreRowDetailsFrozen to True so scrolling at the master level does nothing with the content scroller

    2 - Get the master grid scrollbar

    ScrollBar verticalScrollBar1 = this.EquipmentGrid.ChildrenOfType<ScrollBar>().Where(b => b.Name == "PART_VerticalScrollBar").FirstOrDefault();

    3 - Set an event on the master grid scrollbar:

    verticalScrollBar1.ValueChanged += new RoutedPropertyChangedEventHandler<double>(verticalScrollBar1_ValueChanged);

    4 - Then push through the scrollbar position to the detail grid's GridViewScrollViewer.

    (this.IntervalRadGridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault()).ScrollToHorizontalOffset(e.NewValue);

     

    I already do this to synchronize the scrolling of a non-detail grid with the master grid, and it works fine. But I can't seem to get it to work on the detail grid.

    Can you see an approach where a workaround like this might succeed? Any ideas would be most appreciated.

    Thanks,

    Scott

  5. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 26 May Link to this post

    Hello Scott,

    For your convenience, I prepared an example to demonstrate how to achieve the desired behavior. Please take a look at the implementation and consider how this approach fits your scenario. Keep in mind that this is some kind of customization which is not fully tested.
    I hope that this helps. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Martin Vatev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.

    For your convenience, I prepared an example to demonstrate how to achieve the desired behavior . Please take a look at the implementation and consider how this approach fits your scenario.
    I hope that this helps. Should you have any other questions, do not hesitate to contact us.
  6. Scott
    Scott avatar
    12 posts
    Member since:
    Jun 2014

    Posted 26 May in reply to Martin Vatev Link to this post

    Thank you so much for the help! It's working now.

    Note to others: the ScrollBar was not being built because my ActualWidth and actualHeight were 0. I forced a Measure and Arrange first and all began working:

    EquipmentGrid.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
    EquipmentGrid.Arrange(new Rect(0, 0, EquipmentGrid.DesiredSize.Width, EquipmentGrid.DesiredSize.Height));

    Thanks again! I'd have been stuck without the working example to dissect!

     

Back to Top
UI for WPF is Visual Studio 2017 Ready