效果如图:
重点是判断滑动到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();
}
}
示例代码
参考资料
原文地址:https://www.cnblogs.com/Lulus/p/12516721.html
时间: 2024-09-30 18:48:35