Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Having problems working with RefreshListView and IsLoading binding.

$
0
0

I've created a GitHub solution that can be downloaded which has 3 questions I'm trying to solve. The project can be found here and can be launched on the iOS simulator. I'm trying to do a few things:

  1. I want to be able to show the refresh indicator when the control is populating with initial data. In my real solution this is where the view model grabs data from a web service.

  2. I'm curious as to why the GUI won't update if I set the bound Data property to a new ObservableCollection (populated with data obviously). Note that adding / removing / clearing the collection works fine, but setting it to a new collection does not, even if I explicitly raise OnPropertyChanged.

  3. In the constructor of ListPage, I call InitializeAsync without awaiting it. In InitializeAsync I await the call to populate my initial data. Is there a better way to do this? I'm not sure whether this is the reason the refresh indicator isn't animating.

Previously when I've had issues getting a binding to update, I was advised to use Task.Run to avoid blocking the UI thread, but in this case the ExecuteRefreshCommandAsync method which works as expected runs on the UI thread with await. Also, I started to run into issues with shared memory by simply wrapping calls in Task.Run because usually the calls are from a Service class that has members for accessing a SQLite database and/or a web service.


Viewing all articles
Browse latest Browse all 58056

Trending Articles