I can set the height of a viewcell to a different value for each cell in the viewcell's constructor, but what if I don't know the height at this point? Practically, this is not much use. I'm sure I'm not alone in hoping that this property can be set the height of the viewcell to the height of the content. An example of how to do this would be great.
Previously, in my own implementation of hasunevenrows (http://forums.xamarin.com/discussion/comment/63448#Comment_63448) I called:
uiCell.SetNeedsLayout();
uiCell.LayoutIfNeeded();
in UITableViewSource.GetHeightForRow
This caused the layout to be calculated in the ViewCell's View (in my case a StackLayout) and I could set the viewcell's height in the SizeChanged event of the StackLayout:
this.stackLayout.SizeChanged += (sender, e) =>
{
var sizeRequest = this.stackLayout.GetSizeRequest(this.ParentView.Width, double.PositiveInfinity);
this.Height = sizeRequest.Request.Height;
};
Unfortunately, the SizeChanged event occurs too late to affect the size of the cell so I can't use this approach. What is the suggested way to set the ViewCell's height to the height of it's contents?