var border = VisualTreeHelper.GetChild(myDataGrid,
0) as Decorator;
if (border != null && border.Child !=null)
{
  var scrollViewer =
border.Child as ScrollViewer;
 
if (scrollViewer != null)
 
{
 
  scrollViewer.ScrollToTop();
 
}
}
