BTW I'm using UWP in case it matters. So I am using a ListView and all ListViews have a ScrollViewer attached to them (in default template) by default. The problem is that I cannot find an event (on the ListView itself or on its ScrollViewer) that triggers when the ListView finishes scrolling.
I used the scrollViewer.ChangeView() method to automatically scroll to the beginning of the ListView and it uses an animation to scroll to the top, so I think that has something to do with it because the ViewChanged event fires before the animation completes. If I am correct about that then there would have to be a way to determine if the animation is complete because I need to be alerted when the ListView is completely idle again, which is only when the scroll animation completes. Thanks.
You can wire up the scrollViewer's ViewChanged event, and check the IsIntermediate of the event argument.
private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{
if (e.IsIntermediate)
{
System.Diagnostics.Debug.WriteLine("scroll ongoing");
}
else
{
System.Diagnostics.Debug.WriteLine("scroll finish");
}
}
This event is fired multiple times. When the scroll finishes, IsIntermediate is false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With