I am using the code below as a custom cell in a listview. I am trying to use ForceUpdateSize() in order to update the cell of the listview whenever there is a change in the bound properties. The listview has the attribute HasUnevenRows="True". Still, when I change the name property to a long string at runtime (by using a button) in iOS, the row does not expand. But when string is long in the beginning of the application, the row has enough space to show the whole string. In Android, it seems to work fine even without the ForceUpdateSize() call. What should be done to update the height of the row to adapt to the changing content in iOS?
public class CustomCell : ViewCell
Label age = new Label();
Label name = new Label();
StackLayout cellWrapper = new StackLayout();
age.PropertyChanged += UpdateCell;
name.PropertyChanged += UpdateCell;
View = cellWrapper;
void UpdateCell(object sender, EventArgs e)
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue, we would very much appreciate it.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d
Xamarin Forms Team
You can reach the sample project following the link below:
When you start the application on iPhone and click "Change Name" button, you will see that the new name label for the first row will be changed and this long name will not fit in. As you scroll down and up again, you will see the row heigth increased in order to show the whole label. (I think this is due to row recycling)
Aha! Yes, I see the issue when the ListView uses RecycleElement. That was the missing piece. Thank you!
You're welcome. Row height adjusts when the cell is recycled but not when the bound data changes. And ForceUpdateSize() and such does not seem to help.
It seems to be an important issue actually but I cannot change the "importance" field of the bug. Would you consider prioritizing it?
By the way, I am not familiar with the bug fixing process of Xamarin. Does a bug like this usually get fixed in a month or so?
Any update on this one?
Should be fixed in 2.3.5-pre1
Sounds much like mine https://bugzilla.xamarin.com/show_bug.cgi?id=53359
Which still exists in 2.3.5-pre