c# - Xamarin Listview within Stacklayout displays incorrectly on iOS -
i have following xaml
<stacklayout orientation="vertical" verticaloptions="endandexpand" horizontaloptions="fillandexpand" margin="0,0,0,0"> <label text="menu" /> <listview x:name="lvmenu" itemselected="lvmenu_itemselected"> <listview.itemtemplate> <datatemplate> <imagecell imagesource="{binding imagesource}" text="{binding titletext}" /> </datatemplate> </listview.itemtemplate> </listview> </stacklayout>
the following c# populates it
private void populatemenu() { var menu = new list<settingitem>() { new settingitem() { imagesource="icon.png", titletext="show jobs", targetpagetype = typeof(joblistpage) }, new settingitem() { imagesource="opportunities.png", titletext="sync tasks", targetpagetype = typeof(syncpage) }, new settingitem() { imagesource="leads.png", titletext="advanced settings", targetpagetype = typeof(settingspage) }, new settingitem() { imagesource="contacts.png", titletext="about ", targetpagetype = typeof(aboutpage) }, }; lvmenu.itemssource = menu; }
its when displays
menu show jobs sync tasks advanced settings
and 7 blank lines on ios emulator
the default behaviour on ios listview add empty rows.
to overcome this, need wrap listview in stackpanel,
or create custom rendered:
protected override void onelementchanged(elementchangedeventargs<listview> e) { base.onelementchanged(e); if (this.control == null) return; this.control.tablefooterview = new uiview(); }
source : xamarin
Comments
Post a Comment