Saturday, 15 September 2012

grid - How to setup Row/Column Definitions in Xamarin.Forms Xaml? -



grid - How to setup Row/Column Definitions in Xamarin.Forms Xaml? -

i managed setup rows , columns code couldn't move settings xaml:

class="lang-cs prettyprint-override">grid.rowdefinitions = new rowdefinitioncollection { new rowdefinition { height = new gridlength(1, gridunittype.star) } }; grid.columndefinitions = new columndefinitioncollection { new columndefinition { width = new gridlength(1, gridunittype.star) } };

the next doesn't work:

class="lang-xml prettyprint-override"><grid x:name="grid" verticaloptions="fillandexpand" horizontaloptions="fillandexpand"> <grid.rowdefinitions> <rowdefinition height="*"/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*"/> </grid.columndefinitions> ... </grid>

from documentation managed fetch c# implementation

i same behaviour (does not fill , expand) grid single cell (1 row / column, although not sure why ever need grid single cell total size of screen), seems work fine 2 x 2, 3 x 3 cell grid (have not tried others yet).

the height="" , width="" attributes required in xamarin forms although "think" not needed in wpf default assumes case.

<contentpage.content> <grid verticaloptions="fillandexpand" horizontaloptions="fillandexpand"> <grid.rowdefinitions> <rowdefinition height="*"></rowdefinition> <rowdefinition height="*"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*"></columndefinition> <columndefinition width="*"></columndefinition> </grid.columndefinitions> <button grid.row="0" grid.column="0" text="1"></button> <button grid.row="1" grid.column="1" text="2"></button> </grid> </contentpage.content>

grid xamarin xamarin.forms

No comments:

Post a Comment