Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 for Bug 60608 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 25627 [details]
When using a DataTemplate Selector in Xamarin Forms (Android) the ViewCell BindingContext is sometimes set to the wrong Template.
If you look at the Repro project I've added. Build it and click on an item to get the error.
ListView with a DataTemplate selector that has multiple templates (viewcells). Each of those cells use a grid to 'layout' the cell.
Those cells are getting a variable length of text (so that we force HasUnEvenRows to work).
In the repro project there are 4 templates, 1 that displays the name and 1 tag. The other 3 display the name and the first 3 tags.
Once you click on an item, a template that should display 3 tags gets it's BindingContext updated with an item that should receive the template that displays only 1 tag (as it has only 1 tag). Hence the error and you can see that the DataTemplateSelector or the mechanism behind it is Updating the bindingcontext of the wrong template.