OK here is how I did this. It is probably really dirty, but it works so I am moving on. I was getting an object from a WCF service called ShipmentInventory. This Object contained an ObservableCollection of ShipmentInventoryItem. This observable collection is what I was binding to the ListView:
<?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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Mvx.MvxListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
local:MvxBind="ItemsSource ShipmentInventory.Items"
local:MvxItemTemplate="@layout/inventoryitemview" />
<FrameLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/frameLayout2" />
<EditText
android:inputType="date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText1" />
</LinearLayout>
This uses InventoryItemView as the template for the MvxListView which is as follows:
<?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:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<MvxSpinner
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:padding="2dp"
local:MvxBind="ItemsSource TagColors; SelectedItem TagColor"
android:id="@+id/spinner1" />
<EditText
android:layout_width="300dip"
android:layout_height="wrap_content"
style="@style/InputEditText"
local:MvxBind="Text InventoryNumber" />
<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"
style="@style/InputEditText"
local:MvxBind="Text Articles" />
</LinearLayout>
So the trick was having the ShipmentInventoryItem to have a TagColors property which contains a list of colors. The thought of returning this from the WCF service wasn't very appealing. Then I remembered that svcutil.exe creates a bunch of partial classes to create each object. Well if they can do it, so can I :) Here is what I added to my DataModel code:
public partial class ShipmentInventoryItem
{
private static string[] _TagColors = { "Yellow", "Brown", "White", "Blue", "Orange", "Red", "Green", "Purple" };
public string[] TagColors
{
get { return _TagColors; }
}
}
It worked like a champ. Just be sure it is in the namespace where WCF created your objects. Since the array is declared static, I am pretty sure there is only ever one instance of it. I am new to this so if anyone sees a reason for me not to do it this way, please let me know. Otherwise, I hope this helps someone in the future.