Reputation: 26227
I have a standard ListView
with a GridView
. Now I want one of the columns in the GridView
to be the 1-based index of that line in the list, as such:
| # | First name | Last name |
| 1 | John | Smith |
| 2 | Anne | Anderson |
How do I do that?
Upvotes: 1
Views: 2362
Reputation: 1312
Forgot to answer this one, since the columns are static, you can create an ItemSource binding to the array or whatever is holding the items.
<GridView ItemSource="{Binding ArrayName}"
ItemTemplate="{StaticResource gridViewTemplates}"
Name="Whatever" ...>
</GridView>
And now we have to set the template
<DataTemplate x:Key="gridViewTemplates">
<TextBlock Row="{Binding RowNumber}" Column="0" Name="Id"
Text={"Binding Id"} />
</DataTemplate>
Please do the changes to whatever suits you best.
More Info on this tutorial.
Upvotes: 1