Setting HeightRequest back to Auto in Xamarin.Forms

In Xamarin.Forms, I want to be able to set the exact height for a control whose height is initially determined using only VerticalLayoutOptions (in this case FillAndExpand), and then at a later point reset the height of the control for automatic detection.

In regular XAML, this can be done using double.Nan, but the following causes an exception:

control.HeightRequest = double.NaN 

How do you set the HeightRequest value for self-determination?

+8
xaml xamarin xamarin.forms xamarin-studio
source share
1 answer

After some research, this seems more likely than using double.NaN Xamarin.Forms uses the value "-1". Using the following settings, the control will automatically detect its own height:

 control.HeightRequest = -1; 

The problem is resolved, but I hope Xamarin will update it, so it will use the usual XAML method soon.

+12
source share

All Articles