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

Detail GridView Frozen Column still scrolling when master Gridview scrolls

4 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 17 May 2016, 11:45 AM

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

4 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 19 May 2016, 12:57 PM
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.
0
Scott
Top achievements
Rank 1
answered on 24 May 2016, 07:12 PM

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

0
Martin
Telerik team
answered on 26 May 2016, 12:17 PM
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.
0
Scott
Top achievements
Rank 1
answered on 26 May 2016, 05:27 PM

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!

 

Tags
GridView
Asked by
Scott
Top achievements
Rank 1
Answers by
Martin
Telerik team
Scott
Top achievements
Rank 1
Share this question
or