MVVMCross Binding to an ObservableCollection in a Layout.axml file.

JoeHonourJoeHonour GBMember
edited August 2015 in Xamarin.Android

Hey,

I am trying to implement the MVVMCross design pattern and am having trouble working out how to bind to an ObservableCollection from my ViewModel, in my Views Layout file.

My ViewModel contains only an observable collection with some default objects being added to it in the constructor.
The observable collections objects have only 2 properties, Name and Description.

My View:

public class MemoryWallView : MvxActivity 
{
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.MyLayout);
        }
    }
}

MyLayout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    //add the list view here with binding
</LinearLayout>

Thanks for the help,

Best Answers

Answers

Sign In or Register to comment.