-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] CollectionView does not change from EmptyViewDataTemplate to NonEmptyViewDataTemplate through data template selector from version Xamarin.Forms 4.5 #10831
Comments
Can you please attach a small project that demonstrates this issue? Thanks! |
@poliahrameshkumar Could you share a small project that demonstrates the issue?. If not, don't worry, but I would like to know how do you validate the validation you use in the DataTemplateSelector to change from one template to other one (just to replicate the same case). |
@jsuarezruiz It is simple. Make the EmptyViewDataTemplate visible by keeping the item source of CollectionView empty. Then you can load few values to CollectionView and check if the DataTemplate changes from EmptyViewDataTemplate to NonEmptyViewDataTemplate. If required, I can create sample tomorrow and attach here. |
@poliahrameshkumar I created a sample: Is working fine on Android and in iOS is failing the first time, when adding successive items, it works correctly. |
@jsuarezrui I did little research with both my current app and your sample app. The issue in sample app starts appearing from Xamarin.Forms 4.3.0.991250. But this issue is not reproducible with latest Xamarin.Forms 4.6.0.847. The issue in my current app starts only from Xamarin.Forms 4.4.0.991477 and it is still reproducible with latest Xamarin.Forms 4.6.0.847. So, the issue I am facing is more related to EmptyView and EmptyViewTemplate of CollectionView. The issue sample you created is more specific to ItemTemplate change. Both might be related to each other, but still they differ. We can get to know that by the above observation. Anyhow, Thank you for the sample which gave me a workaround to fix the issue. The issue for both is same of DataTemplate not changing when the first element added for ItemsSource or first assignment happened for ItemsSource. Temporarily adding an element and removing element for the second time is a workaround. |
There's a small possibility #13678 fixes this issue. |
This issue has got fixed in Xamarin.Forms 5.0. Thank you for the support. |
Description
We use CollectionView where till the values load, we show Setting up loading indicator. This indicator is present in EmptyViewDataTemplate. For both EmptyView and NonEmptyView DataTemplates we use data template selector. This works in Xamarin.Forms 4.3 version but in 4.5 and 4.6 this is not working. Even after CollectionView ItemsSource is not empty, still EmptyViewDataTemplate only is present in UI and it is not changing to the required DataTemplate even after the ItemsSource becomes nonempty.
Steps to Reproduce
Expected Behavior
DataTemplate should change from EmptyView to NonEmptyViewDataTemplate
Actual Behaviour
DataTemplate is not changing from EmptyView to NonEmptyViewDataTemplate
Basic Information
Screenshots
Reproduction Link
Workaround
The text was updated successfully, but these errors were encountered: