xaml - Xamarin Forms StackLayout: How to set width / height of children to percentages -
is there way create vertical stack layout button takes 30% of of parent, , text input takes 70% of parent? this:
<stacklayout orientation="vertical"> <entry height="70%"></entry> <button height="30%">click me</button> </stacklayout>
but doesn't work. solution far creating complete grid item , using that. there no other solutions?
stacklayout doesn't go varying heights in scenario. xamarin forms engines isn't rounded wpf engine @ point. have go
<grid> <grid.rowdefinitions> <rowdefinition height="7*" /> <rowdefinition height="3*" /> </grid.rowdefinitions> <entry grid.row="0" verticaloptions="fill"></entry> <button grid.row="1" verticaloptions="fill">click me</button> </grid>
also side note, grids can expand full width or height of parent element. stacklayout's determine maximum size sum of children unless within grid , put horizontaloptions="fill"
, verticaloptions="fill"
.
the other way accomplish deviceheight , width os , manually set heights of elements. complex , flawed approach, don't recommend.
Comments
Post a Comment