xamarin.android - Binding multiple targets to same source -
i making page contains viewpager
pages consist of textview
displaying title , listview
displaying charts custom view have made.
i have working fine in wp7, following code:
<controls:pivot title="stakeholder"> <controls:pivotitem header="last hour"> <scrollviewer> <itemscontrol itemssource="{binding locations}"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel> <textblock text="{binding name}" horizontalalignment="center" /> <chart:minicharthour minmaxrange="{binding charthourrange}" data="{binding charthoursamples}" margin="0,0,0,15" /> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </scrollviewer> </controls:pivotitem> <!--pivot item last day--> <controls:pivotitem header="last day"> <scrollviewer> <itemscontrol itemssource="{binding locations}"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel> <textblock text="{binding name}" horizontalalignment="center" /> <chart:minichartday minmaxrange="{binding chartdayrange}" data="{binding chartdaysamples}" margin="0,0,0,15" /> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </scrollviewer> </controls:pivotitem> ... more of these here ... </controls:pivot>
on wp7 using pivot
control, similar viewpager
in android. locations
property observablecollection
holds locationviewmodel
s. each of locationviewmodel
s have ranges , data 4 different charts each displaying different granularity of data. in code above locations
property bound several times without problems. when want similar on android, swissbindings
spew out lot of warnings path bound more once. view code on android looks this:
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res/bk.ems.stakeholder.ui.droid.vnext" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/chartheader" android:layout_height="wrap_content" android:layout_width="match_parent" android:textappearance="?android:attr/textappearancelarge" local:mvxbind="text name" /> <relativelayout android:layout_height="fill_parent" android:layout_width="fill_parent"> <mvx.mvxbindablelistview android:id="@+id/chartlisthour" android:layout_height="fill_parent" android:layout_width="fill_parent" android:cachecolorhint="#00000000" android:listselector="#00000000" android:orientation="vertical" local:mvxitemtemplate="@layout/chartdetailhour" local:mvxbind="itemsource locations, visibility ishourvisible,converter=visibility" /> <mvx.mvxbindablelistview android:id="@+id/chartlistday" android:layout_height="fill_parent" android:layout_width="fill_parent" android:cachecolorhint="#00000000" android:listselector="#00000000" android:orientation="vertical" local:mvxitemtemplate="@layout/chartdetailday" local:mvxbind="itemsource locations, visibility isdayvisible,converter=visibility" /> ... more of bindablelistviews here ... </relativelayout> </framelayout>
the exceptions are:
problem parsing swiss binding mvxexception: cannot specify path more once - first path 'locations', second path 'visibility ishourvisible', position 50 in itemsource locations, visibility ishourvisible,converter=visibility @ cirrious.mvvmcross.binding.parse.binding.swiss.mvxswissbindingparser.parsenextbindingdescriptionoptioninto (cirrious.mvvmcross.binding.interfaces.parse.mvxserializablebindingdescription description) [0x00000] in <filename unknown>:0 @ cirrious.mvvmcross.binding.parse.binding.swiss.mvxswissbindingparser.parsebindingdescription () [0x00000] in <filename unknown>:0 @ cirrious.mvvmcross.binding.parse.binding.swiss.mvxswissbindingparser.parsetargetpropertynameanddescription () [0x00000] in <filename unknown>:0 @ cirrious.mvvmcross.binding.parse.binding.swiss.mvxswissbindingparser.tryparsebindingspecification (system.string text, cirrious.mvvmcross.binding.interfaces.parse.mvxserializablebindingspecification& requestedbindings) [0x00000] in <filename unknown>:0
you should use ";" instead of "," add more 1 binding-description.
local:mvxbind="itemsource locations; visibility isdayvisible,converter=visibility"
should work :-)
Comments
Post a Comment