Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[UWP] Reuse the element when recycling an ItemContentControl #11043

Merged
merged 2 commits into from Jun 30, 2020
Merged

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Jun 14, 2020

Description of Change

ItemContentControl is currently re-creating the hosted Element and its children when it's reused, rather than using the previously created content.

This change fixes that issue, so the CollectionView won't create new elements for every single item as it scrolls.

Issues Resolved

API Changes

None

Platforms Affected

  • UWP

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

Control Gallery -> CollectionView Galleries -> DataTemplate Gallery -> DataTemplateSelector Gallery
If you scroll around and the weekday items remain the same while the weekend items are different, then this is working.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@hartez hartez added a/collectionview in-progress This issue has an associated pull request that may resolve it! p/UWP labels Jun 14, 2020
@velocitysystems
Copy link
Contributor

This is great @hartez, I think we'll really see some tangible benefits from this improvement!

@hartez
Copy link
Contributor Author

hartez commented Jun 17, 2020

I should have time to implement the DataTemplateSelector checks tomorrow.

@hartez hartez marked this pull request as ready for review June 18, 2020 15:11
@samhouts samhouts added this to In Review in 4.7.0 Jun 20, 2020
@hartez hartez changed the base branch from 4.7.0 to master June 20, 2020 16:56
@samhouts samhouts removed this from In Review in 4.7.0 Jun 20, 2020
@samhouts samhouts changed the base branch from master to 4.8.0 June 26, 2020 00:01
@rmarinho rmarinho merged commit 835c734 into 4.8.0 Jun 30, 2020
@rmarinho rmarinho deleted the fix-9051 branch June 30, 2020 22:42
@samhouts samhouts added the approved Has two approvals, no pending reviews, and no changes requested label Jun 30, 2020
@samhouts samhouts added this to Done in Sprint 172 Jul 1, 2020
bmacombe pushed a commit to bmacombe/Xamarin.Forms that referenced this pull request Jul 7, 2020
…#11043) fixes xamarin#9051

* Reuse the element when recycling an ItemContentControl;
Fixes xamarin#9051

* Ensure that reused ItemContentControl instances respect DataTemplateSelector
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/collectionview approved Has two approvals, no pending reviews, and no changes requested in-progress This issue has an associated pull request that may resolve it! p/UWP t/bug 🐛
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants