locked
How to determine when the scrollviewer has ended scrolling? RRS feed

  • Question

  • I need to adjust the scrollviewer to some point after the users has completed scrolling. For that i need to get to listen to when the scrolling has ended.

    iOS's UIScrollView has some similar methods

    - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView that is called when the scrollview
    
    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
    
    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate

    I tried ViewChanging and ViewChanged, But problem with handling both events simultaneously is that they occur one after another. Like following:

    view changing

    view changed

    view changing

    view changed

    ..

    ..

    instead of -

    view changing

    view changing

    view changing

    view changing

    view changed

    Is there any way i can get the notification for when the scrollviewer has done scrolling or done scrolling-through-dragging?

    Please help.

    Monday, January 20, 2014 12:49 PM

Answers

  • There is no direct event for this. Typically you would update live rather than waiting, but you can run a timer and guess that if you haven't received scroll events for a tenth of a second then scrolling has stopped. You'll need to teßt nd tune the exact time for your specific needs.
    Monday, January 20, 2014 2:11 PM
    Moderator

All replies

  • There is no direct event for this. Typically you would update live rather than waiting, but you can run a timer and guess that if you haven't received scroll events for a tenth of a second then scrolling has stopped. You'll need to teßt nd tune the exact time for your specific needs.
    Monday, January 20, 2014 2:11 PM
    Moderator
  • Thank you for your answer. Actually I am trying to create a control with scrollviewer consisting of a grid with many rows. User can scroll through rows. But when he stops scrolling i want the scrollviewer to adjust to the nearest row so that the whichever row is at top, that row is completely visible. For that i may have to scroll up or down by setting the offset manually.
    Monday, January 20, 2014 5:59 PM
  • Check the IsIntermediate flag in ViewChangedEventArgs. This flag will return "false" for the last ViewChanged event which indicates that the user has stopped scrolling.

    Harini Kannan | Program Manager, XAML

    Monday, January 20, 2014 10:13 PM