Say I have a ListView with a datasource list called DS
data-win-options="{ itemDataSource: NameSpace.DS.datasource,
Say DS has just two objects inside it, with two fields A and B:
DS: new WinJS.Binding.List([ { A: 1, B: 2 }, { A: 3, B: 4 } ])
Now, in my template, say I have an element that depends on both A and B (say it needs to show the sum of A and B). So, I need to do one of the following:
- Bind this element to the two fields, and use a converter to return the sum of the two fields.
- Bind the element to the object itself, and then use a converter to return the sum of the two fields.
- Bind the element to A, and inside the converter, use the index of the current object to get the value of B. In this case, I need a way to get the index of current object in the converter.
Is any of these possible? Or is there any other way I can achieve what I want to?