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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to scroll the SfDataGrid when we load within ScrollViewer using arrow keys?

Thread ID:

Created:

Updated:

Platform:

Replies:

136890 Apr 5,2018 04:05 AM UTC Apr 11,2018 04:16 AM UTC WPF 3
loading
Tags: SfDataGrid
Ariel
Asked On April 5, 2018 04:05 AM UTC


Jai Ganesh S [Syncfusion]
Replied On April 10, 2018 04:02 AM UTC

Hi Ariel, 
 
You can achieve your requirement to scroll the datagrid items using arrow keys while loading the datagrid inside the scroll viewer by override the ProcessKeyDown method in SelectionController like below, 
 
protected override void ProcessKeyDown(KeyEventArgs args) 
{ 
    var scrollviewer = Application.Current.MainWindow.FindName("scrollviewer") as ScrollViewer; 
    base.ProcessKeyDown(args); 
             
    if (args.Key == Key.Down  ) 
    { 
        scrollviewer.ScrollToVerticalOffset(scrollviewer.VerticalOffset + 24); 
    } 
    else if(args.Key == Key.Up ) 
    { 
        scrollviewer.ScrollToVerticalOffset(scrollviewer.VerticalOffset - 24); 
    } 
} 
 
 
In the above sample, we have increase/decrease the Vertical Offset value of scroll viewer as 24. Likewise, you can set the VerticalOffset value based on your requirement in your application. 
 
Regards, 
Jai Ganesh S

Ariel
Replied On April 10, 2018 06:31 AM UTC

Hi Jai Ganesh

Thanks for the helping me to solved my problem. 

Thanks again

Jai Ganesh S [Syncfusion]
Replied On April 11, 2018 04:16 AM UTC

Hi Ariel,  
 
Thank you for the update. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Jai Ganesh S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;