The EmptyView shows immediately together with the refresh spinner.
EmptyView does not show while IsRefreshing is true. At least for the first time.
Immediately shows EmptyView
Having a boolean inside EmptyView to binded to IsVisible. That way you can control if the EmptyView content is shown at all.
@jantanis You want the CollectionView to remain completely blank until at least one item is loaded. After that, if all of the items are removed, the EmptyView will be visible. Is that correct?
@hartez Yes. The refreshview is having a spinner indicating that it's loading. So when it's loading you cannot determine if there will be results. Therefor it would make sense if the emptyview is not shown until binded to an actual (empty or not) collection. So if bindablecollection is null, do not show emptyview. Makes sense because that is not an empty collection.
@hartez Yes. The refreshview is having a spinner indicating that it's loading. So when it's loading you cannot determine if there will be results. Therefor it would make sense if the emptyview is not shown until binded to an actual (empty or not) collection. So if bindablecollection is null, do not show emptyview. Makes sense because that is not an empty collection.
For me an approximation that has worked is inside EmptyView to put a label that points to a property of type string. In my ViewModel, before executing the code that loads the collection linked to the CarouselView, I set the Label property to Loading, then I execute the code that loads the CarouselView and if there is no data I change the property of type string linked to the Label to something that describes what previous.
This works whenever you want the visual aspect of the EmptyView that feeds back the collection load to be the same as the visual aspect that feeds back the fact that there is no data to display. It would be good to have an approach that allows two visual aspects to be established.
Hopefully someone from the Xamarin.Forms team can suggest something else.
We won't be changing this behavior for a few reasons:
null
ItemsSource. But if we change to the behavior you suggest, we'd spend the next several years closing bugs claiming that the CollectionView is broken because setting the ItemsSource to null
doesn't show the EmptyView. Also, most users _want_ the refresh animation to display alongside the EmptyView.
Most helpful comment
For me an approximation that has worked is inside EmptyView to put a label that points to a property of type string. In my ViewModel, before executing the code that loads the collection linked to the CarouselView, I set the Label property to Loading, then I execute the code that loads the CarouselView and if there is no data I change the property of type string linked to the Label to something that describes what previous.
This works whenever you want the visual aspect of the EmptyView that feeds back the collection load to be the same as the visual aspect that feeds back the fact that there is no data to display. It would be good to have an approach that allows two visual aspects to be established.
Hopefully someone from the Xamarin.Forms team can suggest something else.