xaml - MvvmCross bind command with parameter in Windows Phone -
xaml - MvvmCross bind command with parameter in Windows Phone -
i working on simple app developped xamarin , mvvmcross. have simple list of items , want click on item open new view.
i managed in android :
this code in .axml of view
listcustomersview.xaml
<mvxlistview android:minwidth="25px" android:minheight="25px" android:layout_width="match_parent" android:layout_height="wrap_content" local:mvxitemtemplate="@layout/listcustomerscell" local:mvxbind="itemssource listcustomers; itemclick showcommand" android:id="@+id/listcustomersview" />
and code in viewmodel file :
listcustomersviewmodel.cs
private mvxcommand<customerlistdto> _showcommand; public icommand showcommand { { homecoming _showcommand ?? (_showcommand = new mvxcommand<customerlistdto>(c => this.showcustomerdetail(c))); } } public void showcustomerdetail(customerlistdto c) { showviewmodel<customerdetailviewmodel>(new customerdetailparameters() { customerid = c.id }); }
as can see, send parameter through command : instance of customerdetailparameters class. works in android, not manage in windows phone.
i m using code in listcustomersview.xaml :
<listbox name="listbox" itemssource="{binding listcustomers}"> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="horizontalcontentalignment" value="stretch"/> </style> </listbox.itemcontainerstyle> <listbox.itemtemplate> <datatemplate> <controls:listcustomerscell /> </datatemplate> </listbox.itemtemplate> <i:interaction.triggers> <i:eventtrigger eventname="selectionchanged"> <i:invokecommandaction command="{binding showcommand}"/> </i:eventtrigger> </i:interaction.triggers> </listbox>
the showcommand called customerlistdto should sent null. imagine not using code. if have idea, take them.
thanks help , have day !
command paramter not passed command. seek below code passing commandparameter vm
commandparameter="{binding elementname=listbox, path=selecteditem}
xaml windows-phone-8 binding xamarin mvvmcross
Comments
Post a Comment