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

Listview bind 'gradually' or async?

$
0
0

I have a listview I'm binding to a result set of Yelp businesses. The list is like 20 or so long. Each one has an image property that's a URL. The listview has an image bound to the image property of the business.

On the page load I'm fetching the list of businesses and assigning the listview.ItemsSource to the list of businesses. The problem is that the listview takes incredibly long to render after its data binding has been populated. Probably about 10 seconds or more. It all renders at the same time too. It goes from blank to rendering everything.

I'm assuming a lot of this time is spent fetching the images from the urls for each business. In Windows UWP, they have a technique where you can render parts of a binding, just to make those parts appear first, while other parts render later, like images. I'm wondering how I might be able to cobble this together in Xamarin Forms.

One solution I can think of is to store a copy of the business list, but with each having a null image property. Keep the original list with the image properties populated. Bind the listview to the copy with no image urls. After the list has finished rendering (I don't know how I could detect that), fill the image properties on the list. This would be picked up by INotifyPropertyChanged, and the images would render?

thanks!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>