c# - How to create a ListView with a static image size Xamarin Forms -
i have list works fine, when bind large image not fill's entire image box size set 100x100, how create image size able adapt resolution ?
xaml code :
<listview backgroundcolor="white" grid.row="2" separatorvisibility="default" hasunevenrows="true" itemselected="item" x:name="listview"> <listview.itemtemplate> <datatemplate> <viewcell> <stacklayout orientation="horizontal"> <image widthrequest="100" heightrequest="100" source="{binding image}"/> <stacklayout orientation="vertical"> <label text="{binding title}" /> <label text="{binding subtitle}" /> </stacklayout> </stacklayout> </viewcell> </datatemplate> </listview.itemtemplate> </listview>
even if put 100x100 image did not complete fill entire box!
the image
control has property aspect
defines how image filled frame.
aspectfill - scale image fill view. parts may clipped in order fill view.
aspectfit - scale image fit view. parts may left empty (letter boxing).
fill - scale image fill view. scaling may not uniform in x , y.
aspect - gets or sets scaling mode image. bindable property.
use fill
if want fill view.
Comments
Post a Comment