xamarin/Xamarin.Forms
[iOS] DataTemplateSelector doesn't work when an item is re-created in code-behind
Aperta
#7836 aperta il 5 ott 2019
a/collectionviewhelp wantedp/iOS 🍎t/bug :bug:up-for-grabs
Metriche repository
- Star
- (5644 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
Description
This works in ListView but not CollectionView. When a template selector is used (in this case with two different data templates) and a button click clears StackLayout children and adds a new view, CollectionView renders items in wrong positions.
Steps to Reproduce
- Run repro.
- Scroll to item 49.
- Click the "Clear" button
- Observe that the scroll position changes and there are multiple items with the new "Cleared at timestamp" view.
Comment out Items.Add(new Model1())Re-run the test.Observe that the issue does not happen this time.
Expected Behavior
Code-behind changes should not confuse the CollectionView when a DataTemplateSelector is used.
Basic Information
- Version with issue: 4.4.0.1211-nightly
- Last known good version: N/A
- IDE: VS2019
- Affected Devices: XS
Screenshots
