I have the following code in my MainWindow.axaml :
<ItemsRepeater Items="{Binding ChannelCollection}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Value, Mode=TwoWay}" Content="{Binding Name}"></CheckBox>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
Here I bind to collection of Channels with Name
and Value
properties. But actual content of my checkbox depends on its index in the collection. I don't want to resolve the Channel myself but want to use converter that maps index to the name. So far I have to know the element index from the axaml code.
I want to have something like this in my Checkbox tag:
Content="{Binding ItemsRepeater.CurrentIndex, Converter={StaticResource IdToNameConverter}}"
How can I do this?