I have a StackLayout (vertical options is Start). I need to add a view to it and after that to get height of StackLayout. How can I do that? Now after adding a view into StackLayout in code behind I get Height property equals 0.
In what part of code you are trying to get the size? It will not work if you check it in constructor or right after you add the view. What you can do in constructor is:
layout.SizeChanged += Layout_SizeChanged;
and then you will get correct size
private void Layout_SizeChanged(object sender, EventArgs e)
{
var h = layout.Height;
}
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