Autincrementing id label in a listview

pkd3vvpkd3vv USMember
edited October 20 in Xamarin.Forms

Hi, my listview itemssource is set to observablecollection and i'm binding it's elements to labels in datatemplate. How do i add autoincrementing label to datatemplate? My first idea was to bind id label to another list but i ran into problems with binding outside itemssource. There has to be more clever way.

<ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>

                    <StackLayout  Orientation="Horizontal" HorizontalOptions="Center">

                        <Label Text="Id}" LineBreakMode="WordWrap" VerticalTextAlignment="Center" /> /Binding?

                        <Label Text="{Binding Name}"  LineBreakMode="WordWrap" VerticalTextAlignment="Center"/>
            .
            .
            .
</ListView.ItemTemplate>

edit:
Workaround is to add VisibleId in model and it works but it's not the answer i'm looking for.

Sign In or Register to comment.