When we add a ListView control in our applications, normally we don’t see a loading control indicator while we wait for the data but there are some properties that help us to add this control. Let’s see!
Let’s Start!
How to add the PullToRefresh icon in the ListView?
I show you bellow the way to create a ListView in the XAML. I will explain you the three needed properties to do the pullToRefresh in the ListView, they can be added in your XAML or in your C# code.
⚪ IsPullToRefreshEnabled: This property indicates if the LisView control will be enable to present the load icon when the control is refreshing. Accepts/Returns a bool value. (Gets a false value by default).
⚪ IsRefreshing: Indicates if the ListView control is actually refreshing. It’s important to know that this property only works if the is IsPullToRefreshEnabled property it’s enabled. Accepts/Returns a bool value.
⚪ RefreshCommand: This property determines the action that will get the ListView when it’s refreshing. Here we can handle the state of IsRefreshing while is finishing the action.
Let’s know the load icon from ListView control
Here I show you a graphical representation of the load icon in the ListView.
Creating an example
XAML
C# code
Good luck with your implementation! ?
Click to see an example in my GitHub.
Spanish post: https://medium.com/@reyes.leomaris/haciendo-pull-to-refresh-en-un-listview-usando-formularios-xamarin-dc90293819bf
References: https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.listview?view=xamarin-forms