xamarin.forms - Do I need to specify Grid.ColumnDefinitions for a simple two column grid in Xamarin? -


i have code:

<viewcell x:name="ss">    <grid verticaloptions="centerandexpand" padding="20, 0">       <grid.columndefinitions>          <columndefinition width="*" />          <columndefinition width="auto" />       </grid.columndefinitions>       <local:labelbodyrendererclass grid.column="0" horizontaloptions="startandexpand" text="show subcategory" />       <switch x:name="ssswitch" grid.column="1" toggled="ssswitch" verticaloptions="center" horizontaloptions="end" />    </grid> </viewcell> 

i found still works fine when remove column definitions:

<viewcell x:name="ss">    <grid verticaloptions="centerandexpand" padding="20, 0">       <local:labelbodyrendererclass grid.column="0" horizontaloptions="startandexpand" text="show subcategory" />       <switch x:name="ssswitch" grid.column="1" toggled="ssswitch" verticaloptions="center" horizontaloptions="end" />    </grid> </viewcell> 

so simple cases needed. far have been able see in ios simulator. i'm not sure when deployed.

as far know, if want more 1 column or row need define them. can't find in documentation says otherwise. if xamarin.forms generate columns (or rows) automatically, have default width or height setting auto. if want have control on how layout, have add definitions , specify widths , heights yourself.

you can test yourself, said have done. if want sure, create scenarios try expand columns or rows without defining them.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -