效果如图:
重点是判断滑动到DataGrid底端(VerticalOffset等于ScrollableHeight),则继续加载数据
private void DataGrid_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
var scrollViewer = e.OriginalSource as ScrollViewer;
if (e.VerticalOffset!=0 && e.VerticalOffset == scrollViewer.ScrollableHeight)
{
GenerateData();
}
}