相关疑难解决方法(0)

MVVMCross在MvxBindableListView中更改ViewModel

我的Android应用程序的问题很小,我不知道如何使用MVVM Cross解决它.

这是我的模特

public class Article 
{
    string Label{ get; set; }
    string Remark { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的ViewModel

public class ArticleViewModel: MvxViewModel
{
    public List<Article> Articles;
    ....

}
Run Code Online (Sandbox Code Playgroud)

我的layout.axml ......

    <LinearLayout
        android:layout_width="0dip"
        android:layout_weight="6"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:id="@+id/layoutArticleList">
        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/editSearch"
            android:text=""
            android:singleLine="True"
            android:selectAllOnFocus="true"
            android:capitalize="characters"
            android:drawableLeft="@drawable/ic_search_24"
            local:MvxBind="{'Text':{'Path':'Filter','Mode':'TwoWay'}}"
            />
      <Mvx.MvxBindableListView
            android:id="@+id/listviewArticle"
            android:choiceMode="singleChoice"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" 
            local:MvxItemTemplate="@layout/article_rowlayout"
            local:MvxBind="{'ItemsSource':{'Path':'Articles'}}" />                
    </LinearLayout>
...
Run Code Online (Sandbox Code Playgroud)

这就是我的问题,"article_rowlayout"

...
<TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/blue">
        <TextView
            android:id="@+id/rowArticleLabel"
            android:layout_width="0dip"
            android:layout_weight="14"
            android:layout_height="wrap_content"
            android:textSize="28dip"
            local:MvxBind="{'Text':{'Path':'Label'}}" />
        <ImageButton
            android:src="@drawable/ic_modify"
            android:layout_width="0dip"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:id="@+id/rowArticleButtonModify" …
Run Code Online (Sandbox Code Playgroud)

android listview viewmodel xamarin.android mvvmcross

8
推荐指数
1
解决办法
5812
查看次数