Avalonia实现滑动加载
Avalonia版本 V0.10.18
private void ScrollViewer_OnScrollChanged(object? sender, ScrollChangedEventArgs e)
{
var vm = (MainWindowViewModel)DataContext;
var t = (ScrollViewer)sender;
// Console.WriteLine($"偏移量:{t.Offset.Length}");
// Console.WriteLine($"可滚动内容范围:{t.Extent.Height}");
// Console.WriteLine($"窗体高度:{t.DesiredSize.Height}");
// Console.WriteLine($"计算后的高度:{t.Extent.Height - (t.DesiredSize.Height *2)}");
if (t.Offset.Length >= t.Extent.Height - (t.DesiredSize.Height *2))
{
vm.Load();
}
}
喜欢的朋友请帮忙点个赞!!!