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

[UWP] CollectionView disable caching item templates with DataTemplateSelector #14238

Merged
merged 2 commits into from
Sep 29, 2021

Conversation

nk221
Copy link
Contributor

@nk221 nk221 commented May 4, 2021

Description of Change

Issue #14236 seems related to #11732 and appeared after pull request #11043.

There we are trying to reuse an ItemTemplate but it doesn't work when CollectionView uses a DataTemplateSelector instead of an ItemTemplate directly.

The solution is not perfect, but it returns CollectionView to working condition as it was before #11043. Template caching still works for an ItemTemplate and disabled when we use a DataTemplateSelector.

That would be great to have a template cache for templates selected by DataTemplateSelector, but I don’t know how to do it exactly. I have tried to cache a renderer with a template as a key, it works incorrectly. Currently, I have no time for further experiments. If you have any advice on how to do it the right way please let me know. I will try to implement it later.

Issues Resolved

API Changes

None

Platforms Affected

  • UWP

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

  • Launch Control Gallery and navigate to issue G14236.
  • Click on the button to add items to ItemSource
  • Scroll down, click, scroll down...

Before fix on the second or third click, we get items with incorrect templates and with 0 in RequestTemplateCount.
After the fix, all items have correct templates.

PR Checklist

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

@jfversluis
Copy link
Member

jfversluis commented Sep 28, 2021

/azp run

@xamarin xamarin deleted a comment from azure-pipelines bot Sep 28, 2021
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

Thanks for your contribution @nk221 look for it in the next service release!

@jfversluis jfversluis merged commit 15b9a77 into xamarin:5.0.0 Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants