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