Expose ScrollState event to list

2 posts, 1 answers
  1. Elad
    Elad avatar
    14 posts
    Member since:
    Jun 2012

    Posted 11 Mar Link to this post


    in order to improve performance, I want to pause downloading of images when user is in fling scrolling mode.

    _myListView.ScrollStateChanged += (object sender, ScrollStateChangedEventArgs scrollArgs) =>
      switch (scrollArgs.ScrollState)
        case ScrollState.Fling:
          ImageService.SetPauseWork(true); // all image loading requests will be silently canceled
        case ScrollState.Idle:
          ImageService.SetPauseWork(false); // loading requests are allowed again
          // Here you should have your custom method that forces redrawing visible list items

    source: https://github.com/molinch/FFImageLoading/wiki/Advanced-Usage

    ScrollStateChanged is came from Android.Widget.AbsListView, but RadListView isn't derived from this class.

    any option to add this event ?

    Thank you

  2. Answer
    Todor avatar
    772 posts

    Posted 12 Mar Link to this post

    Hello Elad,

    Thank you for your question.

    RadListView for Xamarin.Android extends the Android's RecyclerView and this is why it doesn't have the mentioned event of AbsListView. However RecyclerView provides an alternative that you can use for your scenario: the method AddOnScollListener. Here's how you can create such listener:

    public class MyScrollListener : RecyclerView.OnScrollListener {
        public override void OnScrollStateChanged (RecyclerView recyclerView, int newState)
            base.OnScrollStateChanged (recyclerView, newState);
            switch (newState) {
            case RecyclerView.ScrollStateIdle:
                // Scrolling stopped.
            case RecyclerView.ScrollStateSettling:
                // Scrolling is about to stop.
            case RecyclerView.ScrollStateDragging:
                // Scrolling starts.

    Then you can add one to your list view instance:

    this.listView.AddOnScrollListener (new MyScrollListener ());

    I hope this information helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top