question

Dave010 avatar image
0 Votes"
Dave010 asked GaryLewis-9102 answered

How to measure minimum height of StackLayout to encompass children?

How do we measure the minimum height needed for a StackLayout to encompass all of it's children?

I have used stackLayout.Measure(500, 500, MeasureFlags.None).Minimum.Height and it does not take the children into consideration. In this case, the childis an Editor.

Is there another Measure function that I'm not aware of?

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

GaryLewis-9102 avatar image
0 Votes"
GaryLewis-9102 answered

If I understand your question, I think you need to consider the whole layout cycle and override LayoutChildren to capture the sizes of the children. This may help: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/custom

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.