xamarin.forms - custom View Cell in listview having only button clickable -
i want create viewcell stacklayout containing frame border each row. frame contains labels , 1 button. on button click have change screen.
i find issue when render code on ios simulator , found out on selection of rows i.e. viewcell, grays out , show blurred selected row looks ugly. tried disable view cell solved row selection issue disabled button click on row part of it.
i requires button enabled , available click , rest of part on viewcell should not clickable or available select. have use frame border purpose. provides rounded border suggest me solution can use in place of frame borders well.
<listview x:name="lstview" rowheight="150" separatorvisibility="none" ispulltorefreshenabled="false" > <listview.itemtemplate> <datatemplate> <viewcell> <stacklayout padding="10,10,10,10"> <frame outlinecolor="silver"> <grid> <grid.rowdefinitions> <rowdefinition height="*" /> <rowdefinition height="*" /> <rowdefinition height="*" /> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="100" /> </grid.columndefinitions> <label text="car type" grid.row="0" grid.column="0" fontattributes="bold"/> <label text="{binding createddate}" grid.row="1" grid.column="0"/> <label text="{binding transactionid}" grid.row="2" grid.column="0"/> <stacklayout grid.row="0" grid.column="1" orientation="horizontal"> <label text="status" fontattributes="bold"/> <label text="{binding status}" fontattributes="bold"/> </stacklayout> <stacklayout grid.row="1" grid.column="1" orientation="horizontal"> <label text="customer name" /> <label text="{binding custname}" /> </stacklayout> <button text="button" grid.row="1" grid.column="2" clicked="onclicked" commandparameter="{binding displayname}"></button> </grid> </frame> </stacklayout> </viewcell> </datatemplate> </listview.itemtemplate> </listview>
disabling selection if want disable selection, handle itemselected event , set selecteditem property null:
selectiondemolist.itemselected += (sender, e) => { ((listview)sender).selecteditem = null;
};
source: https://developer.xamarin.com/guides/xamarin-forms/user-interface/listview/interactivity/
Comments
Post a Comment