android - ItemClick not bound on Button in MvxGridView -
i have problem binding click
event on item of mvxgridview
(i'm using itemclick
binding).
all rendering fine , stuff. when utilize textview
goclick
method fired properly. when alter textview
button
in itemtemplateview
, goclick
method not invoked more.
according this reply (option number 1) should work fine. in button
case not.
any help appreciated, i'm stuck here.
my viewmodel:
public class myviewmodel : mvxviewmodel { private ienumerable<mylistitem> items; public myviewmodel() { this.items = new list<mylistitem> { new mylistitem {name = "item1"}, new mylistitem {name = "item2"}, }; } public ienumerable<mylistitem> items { { homecoming this.items; } } public icommand selectitem { { homecoming new mvxcommand<mylistitem>(this.goclick);} } public void goclick(mylistitem item) { //dosomething } }
my layout mvxgridview
:
<?xml version="1.0" encoding="utf-8" ?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/black" > <mvx.mvxgridview android:layout_width="300dp" android:layout_height="match_parent" android:gravity="center" android:horizontalspacing="10dp" android:numcolumns="3" android:stretchmode="columnwidth" android:verticalspacing="10dp" local:mvxitemtemplate="@layout/itemtemplateview" local:mvxbind="itemssource items; itemclick selectitem" /> </linearlayout>
my itemtemplateview
(which works fine textview
)
<?xml version="1.0" encoding="utf-8" ?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:layout_height="wrap_content" android:layout_width="match_parent" local:mvxbind="text name" /> <!-- click on button not work --> <!-- <button android:layout_height="wrap_content" android:layout_width="match_parent" local:mvxbind="text name" /> --> </linearlayout>
android xamarin mvvmcross
No comments:
Post a Comment