Load More Items at End of ListView in Xamarin.Forms
I recently published a few blogs on how to add pull to refresh to your Xamarin.Forms iOS and Android applications. This sparked a question from another developer as to if you could swipe to load more at the bottom of the ListView. My feedback here is that a swipe to load more isn’t normal in mobile applications. A quick work around is to have a button as the final cell that is pressed to load more, but even better would be to detect when you user has hit the bottom of the screen and then load more items. So let’s do it!
ItemAppearing to the Rescue
In Xamarin.Forms it is actually extremely easy if you just subscribe to the ItemAppearing event in your code and check to see if the item that was visible is the last item in the list. I prefer to have a unique Id on each item that I would be checking here, but for this sample I will just check the string which is unique.If you are looking to implement this in a traditional apps it is pretty simple as well. On iOS you already have the DataSource that you can look into when GetCell is called. On Android you can actually tie into the scroll events like I do in Meetup Manager.