Adding pull-to-refresh
As with the new entry page, when the main page is loading our data, we should present the user with a loading indicator so that they know their list of entries is on its way. However, since the main page is using a data-bound ListView
instead of a static TableView
, we can use the ListView
pull-to-refresh functionality to indicate when our data is being loaded. Pull-to-refresh also has the benefit of allowing users to easily refresh the screen and load any new data that might be available. Xamarin.Forms makes adding pull-to-refresh very easy, and we will still use the IsBusy
property from our BaseViewModel
, just as we did on the new entry page.
The Xamarin.Forms ListView
pull-to-refresh API requires two things: an ICommand
that handles refreshing the bound source of the ListView
, and a boolean field that indicates whether the ListView
is currently refreshing or not. To add pull-to-refresh, perform the following steps:
- First, we will need to add a new refresh command...