xaml - Xamarin.Forms ListView ViewCell issue on iOS -
i've been trying looking right in xaml (x.forms) can't make work. possibly way can solved in xaml without custom cell renderer?
here how it's supposed on native ios:

what i'm getting far in xaml:

here's xaml:
<scrollview> <stacklayout> <activityindicator isrunning="{binding isfetching}" /> <listview itemssource="{binding events}" header="2015" footer=""> <listview.itemtemplate> <datatemplate> <viewcell height="55"> <viewcell.view> <stacklayout orientation="horizontal" padding="5" backgroundcolor="white"> <stacklayout> <boxview widthrequest="44" heightrequest="5" backgroundcolor="purple" /> <label text="aug" fontsize="12" heightrequest="13" horizontaloptions="center" verticaloptions="start" fontattributes="bold"/> <label text="31" fontsize="13" verticaloptions="startandexpand" horizontaloptions="center" /> </stacklayout> <stacklayout orientation="vertical" horizontaloptions="startandexpand"> <label text="relay life of" fontsize="14" verticaloptions="end" textcolor="gray"/> <label text="hope city" fontsize="16" fontattributes="bold" verticaloptions="startandexpand"/> </stacklayout> </stacklayout> </viewcell.view> </viewcell> </datatemplate> </listview.itemtemplate> </listview> </stacklayout> </scrollview>
you can try grid instead of stack, add rowheight listview
<listview ... rowheight="55"> ... <viewcell height="55"> <grid> <grid.columndefinitions> <columndefinition width="44"/> <columndefinition width="*"/> <columndefinition width="44"/> <!-- checkmark --> </grid.columndefinitions> <grid grid.column="0"> <grid.rowdefinitions> <rowdefinition height="5" /> <rowdefinition height="22" /> <rowdefinition height="17" /> </grid.rowdefinitions> <boxview grid.row="0" widthrequest="44" heightrequest="5" backgroundcolor="purple"/> <!-- experiment vertical alignment right --> <label grid.row="1" text="aug" .../> <label grid.row="2" text="31" .../> </grid> <grid grid.column="0"> <grid.rowdefinitions> <rowdefinition height="22" /> <rowdefinition height="22" /> </grid.rowdefinitions> <!-- if vertical alignment doesn't work add 2 more rows top , bottom padding --> <label grid.row="0" text="relay life" verticaloptions="end" .../> <label grid.row="1" text="hope city" verticaloptions="start" .../> </grid> </grid> </viewcell>
Comments
Post a Comment