android layout - MvvmCross : dynamic item template selection for MvxListView -


if have view 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 itemtemplate1, it possible dynamically set based on type of data want display in view? looking similar functionality wpf's datetemplateselector.

tia.

you have use custom adapter this.

a few of samples show how use cell type selection. see:

e.g. polymorphiclistitemtypesview.cs

        protected override view getbindableview(view convertview, object source, int templateid)         {             if (source kitten)                 templateid = resource.layout.listitem_kitten;             else if (source dog)                 templateid = resource.layout.listitem_dog;              return base.getbindableview(convertview, source, templateid);         } 

for android, there optimisation should added existing polymorphic adapter samples - include use of getitemviewtype better convertview reuse - see https://github.com/slodge/mvvmcross/issues/333

this questions linked to:


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -