If I have a view with the following MvxListView definition:
<Mvx.MvxListView
android:layout_marginTop="10px"
android:textFilterEnabled="true"
android:choiceMode="singleChoice"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="20dp"
local:MvxBind="ItemsSource Data; ItemClick LaunchCapabilityViewCmd"
local:MvxItemTemplate="@layout/itemtemplate1" />
Instead of hard coding MvxItemTemplate to itemtemplate1, it it possible to dynamically set this based on the type of data I want to display in this view? I am looking for similar functionality to WPF's DateTemplateSelector.
TIA.
You have to use a custom adapter to do this.
A few of the samples show how to use cell type selection. See:
polymorphic lists in https://github.com/slodge/MvvmCross-Tutorials/tree/master/Working%20With%20Collections
grouped lists in the session list views in https://github.com/slodge/MvvmCross-Tutorials/tree/master/Sample%20-%20CirriousConference
e.g. from PolymorphicListItemTypesView.cs
For Android, there is also an optimisation which should be added to the existing polymorphic adapter samples - to include use of
GetItemViewType
for betterconvertView
reuse - see https://github.com/slodge/MvvmCross/issues/333This questions is linked to: