Say I have data like this:
So this is a list of lists of dictionary that have name and age, in xamarin.form I create a list view which itemsource is the whole thing, so each cell has itemsource like: { [name='a', age='1'], [name='b', age='2'] }.
Next step I want to create label inside of the viewcell that binding to the "name" of each element in the cell's itemsource, for example label 1 will bind to the name 'a' and label 2 will be name 'b'. I assume that should be something like
so the entire code is something like:
<ListView X:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Label Text = "{Binding CellsItemSource[0].name}" />
<Label Text = "{Binding CellsItemSource[1].name}" />
</ViewCell.View>
<ViewCell>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
In the .cs file:
list = { { [name='a', age='1'], [name='b', age='2'] }, { [name='c', age='3'], [name='d', age='4'] }, { [name='e', age='5'], [name='f', age='6'] } };
listView.itemsource = list;
Now the problem is listView's itemsource is correct. But labels cannot bind to name.
Is there anything I missed?