<ScrollView Scrolled="OnScrollViewScrolled">
<StackLayout BindableLayout.ItemsSource="{x:Static local:NamedColor.All}">
<!--Omitted for breviety-->
</StackLayout>
</ScrollView>
代码隐藏:
private void OnScrollViewScrolled(object sender, ScrolledEventArgs e)
{
if (!(sender is ScrollView scrollView)) return;
var scrollSpace = scrollView.ContentSize.Height - scrollView.Height;
if (scrollSpace > e.ScrollY) return;
//load more items when coming to the end of the list of ScrollView
System.Diagnostics.Debug.WriteLine("Load more items");
}
1条答案
按热度按时间dfuffjeb1#
要在用户到达ScrollView的列表项的下端时检测它的末尾,可以使用下面的代码来实现:
XAML:
代码隐藏: