How to detect if the scroll viewer reaches bottom in winrt

后端 未结 2 1104
执念已碎
执念已碎 2021-01-04 20:34

I\'m wondering what\'s the best approach to detect if a ScrollViewer reaches the bottom, right etc.

I think I can achieve that by using both PointerWheelChanged for

2条回答
  •  旧巷少年郎
    2021-01-04 20:48

    For UWP I got it like this

    
        
    
    
    private void scroll_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
    {
        var scrollViewer = (ScrollViewer)sender;
        if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
            btnNewUpdates.Visibility = Visibility.Visible;
    }
    
    private void btnNewUpdates_Click(object sender, RoutedEventArgs e)
    {
        itemGridView.ScrollIntoView(itemGridView.Items[0]);
        btnNewUpdates.Visibility = Visibility.Collapsed;
    }
    

提交回复
热议问题