1.Wpf DataGrid 自动滚动到最后一列/最后一行/第一列/第一行
if (dataGrid1.Items.Count > 0) { var border = VisualTreeHelper.GetChild(dataGrid1, 0) as Decorator; if (border != null) { var scroll = border.Child as ScrollViewer; if (scroll != null) { scroll.ScrollToEnd();//最后一行 scroll.ScrollToHome();//第一行 scroll.ScrollToLeftEnd();//第一列 scroll.ScrollToRightEnd();//最后一列 } } }