I've been playing with the monodroid/monotouch for a while now and having decided to jump from monocross to mvvmcross, I've hit a bit of a problem.
I have a domain model which contains a sub property which is a list of another domain object. Has-Many if you will. What I'm trying to do is display the aggregate root object and allow the user to fill in the details of the sub object.
public class objA
{
public List<objB> mySubObjs
}
I pretty easily got this hooked up using the MvxBindableListView. Except I couldn't bind to objA.mySubObjs, I had to bring the list up a level in the ViewModel and bind to that? Anyway, the issue I faced is that my itemtemplate for the List looked a bit like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginTop="2dip"
android:layout_marginBottom="2dip">
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="a)"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText xmlns:local="http://schemas.android.com/apk/res/x.x.x.x"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
local:MvxBind="{'Text':{'Path':'Name'}}" />
</RelativeLayout>
Which renders fine, but is just not useable. When I click on the editText control is brings up the softkeyboard and in doing so loses focus. I've read a couple of articles about EditText in ListView's don't work too well.
Therefore I tried building up the List view manually by binding to specific items i.e. objA.mySubObjs[0].Name, but this doesn't seem to reflect back in the ViewModel.
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Question"
android:textAppearance="?android:attr/textAppearanceSmall"
local:MvxBind="{'Text':{'Path':'Items[0].Name'}}" />
I'm at a bit of a loss and didn't really want to go down the route of flattening the List within my ViewModel to accomodate the Android View.
Any help would be appreciated