Is there any way to get the index of the current ItemsControl
item in WPF
?
For example, I want to do something like:
<ItemsControl>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding current_index}">
</TextBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
so that after this, the first TextBox
will show text "0"
, second "1"
, third "2" ...
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…