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

Retain Strategy on Listview with DataTemplateSelector causes BindingContext to revert to null #3602

Open
PureWeen opened this issue Aug 17, 2018 · 0 comments
Labels
a/listview Problems with the ListView/TableView e/4 🕓 4 help wanted We welcome community contributions to any issue, but these might be a good place to start! inactive Issue is older than 6 months and needs to be retested t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!

Comments

@PureWeen
Copy link
Contributor

PureWeen commented Aug 17, 2018

Description

The issue seems to come up because of this await

The await happens, a new template is swapped in, and then the above code sets the BindingContext back to null. If you set the ListView Cache strategy to Recycle the issue doesn't happen because that await doesn't occur

For example I had to do this little hack here

https://github.com/xamarin/Xamarin.Forms/pull/3518/files#diff-bb6d28847711cc5f78841d28a70d000bR168

To make sure the BindingContext doesn't get reset back to null after already being set inside the DataTemplateSelector

Steps to Reproduce

In the Control Gallery remove the hack I added above and you'll see the effect of the BindingContext getting set and then unset to null because of the race condition

Expected Behavior

The BindingContext on the view cell should remain what I set it to. A pending operation shouldn't set it back to null.

Actual Behavior

A pending operation sets the BindingContext back to null

Basic Information

  • Version with issue: 3.2
  • Last known good version: Not sure
@samhouts samhouts added the inactive Issue is older than 6 months and needs to be retested label Feb 14, 2019
@samhouts samhouts added help-wanted up-for-grabs We welcome community contributions to any issue, but these might be a good place to start! help wanted We welcome community contributions to any issue, but these might be a good place to start! and removed help-wanted labels Jun 28, 2019
@samhouts samhouts added the a/listview Problems with the ListView/TableView label Feb 24, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/listview Problems with the ListView/TableView e/4 🕓 4 help wanted We welcome community contributions to any issue, but these might be a good place to start! inactive Issue is older than 6 months and needs to be retested t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!
Projects
None yet
Development

No branches or pull requests

2 participants