In order to expose the item index via binding, we can add it to list-view and repeater with adding
For repeater: after this line
dataItem["$index"] = i;
For list-view: before this line
item["$index"] = index;
This way users will be able to have access to the index of the item in their list like
e.g.
<Repeater items="{{ items }}">
<Repeater.itemsLayout>
<StackLayout />
</Repeater.itemsLayout>
<Repeater.itemTemplate>
<Label text="{{ $index }}" textWrap="true" />
</Repeater.itemTemplate>
</Repeater>
However, this is another operation that will be added for each cell.
Please vote in this issue if we should add this feature or not.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
+1
was my vote correct?
+1
+1
+1
+1
+1
@NickIliev What's the use case of this feature? Isn't it responsibility of the view model to populate each data item with an additional index property when such is needed?
@atanasovg indeed each dev can provide index via the view-model (here) - I think a lot of the users are searching for this feature as out-of-the box indexing (similar to the one provided in Angular `let-i="index")
+1, all the time have to apply workarounds to get the index in list-view and repeater. This is must-have.
+1
+1
+1
Most helpful comment
+1
was my vote correct?