We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfDataGrid scrollviewer once at the bottom start scrolling on parent control if it has a scrollviewer

Hello,

We've been trying to implement a extra function to the datagrid that once the scrollbar is at the end and we keep scrolling down then the scrollbar should scroll the parent control instead of itself, as it's at the end there's no reason to keep scrolling down.

Is there any possible way to do this? Or can this be a new feature request for the datagrid? Thanks.

Have a nice day,
Alexandru.

3 Replies

BR Balamurugan Rajaraman Syncfusion Team August 18, 2017 04:03 AM UTC

Hi Alexandru, 
 
Thanks for contacting Syncfusion support 
 
We have checked your query “How to scroll the parent when the SfDataGrid vertical scroll bar reaches the end”. You can able to achieve your requirement by the below mentioned workaround, Kindly modify your application as like the below code snippet to meet your requirement. 
 
private  void VScrollBar_ValueChanged(object sender, EventArgs e) 
        { 
            if(((Syncfusion.UI.Xaml.ScrollAxis.ScrollInfo)sender).Value >= (((Syncfusion.UI.Xaml.ScrollAxis.ScrollInfo)sender).Maximum - DataGrid3.GetVisualContainer().ViewportHeight)) 
            { 
                var parentElement=FindDescendant(DataGrid3,typeof(ScrollViewer)); 
                (parentElement as ScrollViewer).ScrollToVerticalOffset((parentElement as ScrollViewer).VerticalOffset + 10); 
            } 
            if(((Syncfusion.UI.Xaml.ScrollAxis.ScrollInfo)sender).Value <= ((Syncfusion.UI.Xaml.ScrollAxis.ScrollInfo)sender).Minimum) 
            { 
                var parentElement = FindDescendant(DataGrid3, typeof(ScrollViewer)); 
                (parentElement as ScrollViewer).ScrollToVerticalOffset((parentElement as ScrollViewer).VerticalOffset-10); 
            } 
        } 
 
We have created the sample based upon your requirement and attached that sample for your reference you can able to get it from the below link. 
 
 
Regards, 
Balamurugan R 
  



AP Alexandru Pastor Opris August 18, 2017 08:16 AM UTC

Hello Balamurugan Rajaraman,


Thank you for the reply, I didn't get it to work as I've intended originally but after some tweaking with the code I got it working. I've attached a zip with the datagrid scrolling the parent once is at the end, and if we keep scrolling down, it'll keep scrolling the parent, before it just did the -10 / +10 offset of height on the parent and that's it.


Best regards and thank you again.

Alexandru.


Attachment: DataGridScrollParent_d536c02f.zip


BR Balamurugan Rajaraman Syncfusion Team August 21, 2017 04:25 AM UTC

Hi Alexandru, 
 
Thanks for the update. 
 
Please let us know if you need any further assist on this. 
 
Regards, 
Balamurugan R 


Loader.
Up arrow icon