I have a SurfaceListBox
that inside has a ScrollViewer
. I have access to that ScrollViewer
and I want to detect when the scrolling ends. Since it is a touch app and I can drag it, right now I'm detecting the PreviewTouchUp
to do what I want, however, if I do a fast swipe, like you would do on a smartphone, because the content of the ScrollViewer
is still dragging/scrolling, the PreviewTouchUp
does not reflect the end of the scrolling, but is instead triggered before.
I have tried Manipulation
events and several others on both the ScrollViewer
and the SurfaceListBox
. I have also tried ScrollViewer.PanningDeceleration
and honestly, I don't see a difference. Basically, no luck so far.
So, how can I detect the end of the scrolling, even after the PreviewTouchUp
in a ScrollViewer
?
Seems a bit messy but Sheridan's solution was the best way I could find to determine when a scrollviewer has stopped moving. I just tweaked the timer interval and, more importantly, put the "// Do what you want now that scrolling has stopped" between hittestvisible = false and then hittestvisible = true on the scrollviewer control.
Can't you just handle the
ScrollViewer.ScrollChanged
event? From the linked page, it says that it...So you could just start a
DispatcherTimer
to wait for a short instant each time the event has been raised, eg. when it is scrolling. When the scrolling stops and the event stops being raised, then theTick
handler will be called and you can do whatever you like in it. Try something like this: