Xamarin Forms StackLayout: How to set width / height of children to percentages
Asked 07 September, 2021
Viewed 1.3K times
  • 63
Votes

Is there a way to create a vertical stack layout with a button that takes 30% of of the parent, and a text input that takes 70% of the parent? Something like this:

<StackLayout Orientation="Vertical">
    <Entry Height="70%"></Entry>
    <Button Height="30%">Click me</Button>
</StackLayout>

But this doesn't work. Only solution so far is creating a complete Grid item and using that. Are there no other solutions?

2 Answer