WPF DataGrid下滑动态加载数据
作者:互联网
效果如图:
重点是判断滑动到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();
}
}
示例代码
参考资料
标签:VerticalOffset,ScrollViewer,DataGrid,ScrollableHeight,WPF,加载,scrollViewer 来源: https://www.cnblogs.com/Lulus/p/12516721.html