Scroll detection completed in Xamarin.Forms.Scrollview

I am trying to customize the scrolling view to suit my specific set of requirements and what I would like to do is detect when the user stops scrolling or otherwise lifts their finger off the screen. I've tried several ways to hook up event listeners, but haven't yet found one that actually fires any events.

I need to make this work on android and iOS, and will gladly do it in any cross-platform or platform-specific code.

If anyone can provide any guidance, I would be extremely grateful!

As a small side note, if anyone can explain why my custom scrollview renderer is Touch += MyTouchHandler

not allowed to call my touch handler, that would be extremely helpful.

+3


source to share


1 answer


You can detect this by executing this event handler: Assuming your list is named "Items", you need to add this code to your page.xaml.cs file:

    var listview = new ListView ();

    listview.ItemsSource = Items;
    listview.ItemAppearing += (sender, e) =>
    {
       if(isLoading || Items.Count == 0)
           return;

       //hit bottom!
       if(e.Item.ToString() == Items[Items.Count - 1])
       {
           LoadItems();
       } 
   }

      



You can check the full implementation details here: https://gist.github.com/jamesmontemagno/465ced24fc8a206dcaf3#file-loadmoreonbottom-cs

+3


source







All Articles