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
{
public CustomCell()
{
Label age = new Label();
Label name = new Label();
StackLayout cellWrapper = new StackLayout();
age.SetBinding(Label.TextProperty, "Age");
name.SetBinding(Label.TextProperty, "Name");
age.PropertyChanged += UpdateCell;
name.PropertyChanged += UpdateCell;
cellWrapper.Children.Add(age);
cellWrapper.Children.Add(name);
View = cellWrapper;
}
void UpdateCell(object sender, EventArgs e)
{
ForceUpdateSize();
}
}