android - Bind item object in ItemTemplate in MVVMCross -
i developing mvvmcross multi platform app , i'm having following trouble converters:
i have listview in android following code:
<myprojectname.droid.mvxcustomviews.mvxlistview.mvxdroidlistview android:id="@+id/historiclist" android:layout_width="match_parent" android:layout_height="match_parent" android:cachecolorhint="#00000000" android:listselector="#00000000" android:fadingedge="none" local:mvxbind="itemssource historics;" local:mvxitemtemplate="@layout/historiclistitem" />
where, historics list. then, have in layout resource:
<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:orientation="horizontal"> <imageview android:id="@+id/historicicon" android:layout_width="30dp" android:layout_height="30dp" android:layout_marginright="5dp" android:layout_gravity="center" local:mvxbind="assetimagepath updatetype, converter=historictypetosource" /> <textview android:id="@+id/listhistorictype" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="10dp" android:layout_marginbottom="10dp" android:text="anexo" android:textcolor="#0000ff" android:textsize="16sp" android:layout_gravity="center" local:mvxbind="text updatetype, converter=historictypetostring" /> </linearlayout> <textview android:id="@+id/listhistorictypedetail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="anexo adicionado" android:textcolor="#000000" local:mvxbind="text ???, converter=historicdetailstostring" />
the problem is, working fine, in listhistorictypedetail's textview's bind need pass entire object, because, depending on each historic.action, add text uses historic.additionalparameter, historic.newvalue, historic.oldvalue!!!
i'm not figuring out how pass 3 parameters depending on value of bind converter, or how bind entire object converter like: myconverter : mvxvalueconverter
is clear? can me?
thanks in regards,
given complexity of conversion, think it's easiest pass entire object can using single period:
local:mvxbind="text ., converter=historicdetailstostring"
or - using tibet-syntax - as:
local:mvxbind="text historicdetailstostring(.)"
i think wiki article may help: https://github.com/mvvmcross/mvvmcross/wiki/databinding
e.g.:
if
$sourcepath$
omitted or single period "." used, source used whole of viewmodel.
from https://github.com/mvvmcross/mvvmcross/wiki/databinding#swiss
Comments
Post a Comment