In Xamarin.Forms I want to be able to set the exact height for a control whose height is initially determined using VerticalLayoutOptions only (FillAndExpand in this case) and then, at a later point, reset the height of the control back to be automatically determined.
In normal XAML it is possible to do this via double.Nan but performing the following causes an exception to be thrown.:
control.HeightRequest = double.NaN
How do you set the HeightRequest back to be self-determined?
After some investigation it seems rather than using double.NaN Xamarin.Forms uses the value "-1". Using the following sets the control to automatically determine it's own height again:
control.HeightRequest = -1;
Problem solved but hopefully Xamarin will update this so it uses the normal XAML way soon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With