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 on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
# Steps to reproduce
1. Create a MasterDetailPage with two pages
2. Create a project with ListView and ViewCell as a template
3. Create a list of models, each model has a property as ItemHeight, which returns 20, if we tap the item, ItemHeight should toggle between 20 and 40, so assume that we want to show selected item as a bigger item. ( I know I can use ItemTemplateSelector, but this is not the point).
4. Create Grid inside ViewCell, bind Height of Grid to ItemHeight and setup a Gesture to toggle ItemHeight property
# Expected behavior
1. Height of item should toggle between 20,40
2. When we change between pages of MasterDetailPage, height should retain
# Actual behavior
1. Height does not change after tapping
2. If you change the pages between MasterDetailPage, you can see that Height of item you tapped is now reflecting correctly
When the page is reloaded after we switch pages between master detail page, height of item changes correctly and we see expected height, but it does not reflect immediately. I tried to find exact class where this bug must be appearing, but it seems that ViewCell's ForceLayout or some method does not cause table to recalculate size of height required. However, on full layout pass, it does work correctly.
Can you please attach a reproduction project instead of a description? That helps us triage issues much faster as well as ensuring we're constructing the same test case as you're envisioning.
Here is sample project in Github,
in same repository, there is iOSBug.mp4 video which demonstrates that height of row does not change, however, it does change in android instantly.
I have added the github repo, to reproduce the bug. Also there is a video explaining the bug.
@Akash: Thank you for the detailed report!
For performance reasons, we do not automatically resize ListView rows for you. You will need to call ForceUpdateSize on the ViewCell to get your desired behavior.
Please see https://developer.xamarin.com/samples/xamarin-forms/UserInterface/ListView/DynamicUnevenListCells/ for a detailed example.
Your sample does not work in some cases,
We have a ViewModel which requests web service and on response, some UI elements become visible and some change, we have no way to update View from ViewModel without having to do some complex extra code, which still does not work.
This is bad design, you can create a ViewCell which will force automatic resize if we need, I tried to Create new type of ViewCell, but calling ForceSizeUpdate in OnChildMeasureInvalidated does no effect, the bug exists in the software.
Akash, we've yet to conceive of an efficient, general, and automatic way to detect when to call ForceUpdateSize. So, unfortunately, we pass the buck to the application to decide when a forced update is necessary. The application has more context and yet, as you've discovered, even the non-general case is challenging. Until such time that a general solution can be devised and the non-general case is still to challenging to solve we suggest the application be restructured to use rows of immutable height.