Bug 61248 - [iOS] Listview scrolled cells blank when using DataTemplateSelector
Summary: [iOS] Listview scrolled cells blank when using DataTemplateSelector
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2018-03-03 09:05 UTC by Chad Magendanz
Modified: 2018-03-03 17:32 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Screenshots (before & after scrolling), XAML and code behind (757.81 KB, application/x-zip-compressed)
2018-03-03 09:05 UTC, Chad Magendanz

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Chad Magendanz 2018-03-03 09:05:04 UTC
Created attachment 26200 [details]
Screenshots (before & after scrolling), XAML and code behind

When using a ListView with a DataTemplateSelector, cells scrolled into view appear either partially or fully blank.  The bound collections are still there, since clicking the blank cells brings up the correct detail page, but it seems the cached views have been disposed.

Bypassing the DataTemplateSelector and setting the ItemTemplate to a single DataTemplate fixes the problem.  Also, you won't see the issue as long as you're viewing cells that are all resolved to the same DataTemplate.  It's only when you start switching between templates that the cell contents start disappearing when scrolled into view.

Note: This problem only occurs on iOS platform.  Everything works as expected on Android.

- Screenshot of two types of objects (HouseholdViewModel & ChildViewModel) that resolve to different DataTemplates, before and after scrolling
- Sample ContentPage XAML and code behind of affected ListView

- Visual Studio 2017 v15.5.7
- Xamarin v4.8.118
- Xamarin.iOS SDK v11.6.1.4
- Xamarin Forms v2.5.0.280555
Comment 1 Paul DiPietro [MSFT] 2018-03-03 14:37:20 UTC
Bugzilla issues are no longer tracked. Please file new issues on GitHub.
Comment 2 Chad Magendanz 2018-03-03 17:32:23 UTC