CardView in Xamarin.Forms -
i'm looking way dynamically generate card-like controls these:
i have been doing search , have found this article shows how implement cardview on xamarin.android project. i'm using xamarin.forms can compile ios well.
i tried use listview viewcells , couple stacklayout tags, wasn't able close that, here code:
<listview x:name="listview"> <listview.itemtemplate> <datatemplate> <viewcell height="300"> <stacklayout> <stacklayout orientation="horizontal"> <image source="{binding useravatar}" /> <label text="{binding username}" /> </stacklayout> <image source="{binding bittimage}" /> </stacklayout> </viewcell> </datatemplate> </listview.itemtemplate> </listview> i'm pretty new xamarin, if i'm missing basic, please let me know guys.
you on right track. use listview, frame root element , margin, , set background color of listview appropriate. should give card look. fill in card require.
<listview x:name="listview" backgroundcolor="gray"> <listview.itemtemplate> <datatemplate> <viewcell height="300"> <frame hasshadow="true" margin="5"> <stacklayout> <stacklayout orientation="horizontal"> <image source="{binding useravatar}" /> <label text="{binding username}" /> </stacklayout> <image source="{binding bittimage}" /> </stacklayout> </frame> </viewcell> </datatemplate> </listview.itemtemplate> </listview> 
Comments
Post a Comment