Let me preface this by saying, I'm not sure if this is even possible. I've got two similar collections of complex objects that I'm using as source data for two different Items controls. Well, let's call the first collection the old
data, and let's call the second collection the new
data.
Like I said above, I've got two items controls - one binding to old
, and the other binding to new
. Well, in the item template of the new
items control, I want to be able to bind to the old
data, however I need to be able to use an index because the property is List of items. Maybe code snippets will help explain what I'm after:
<ItemsControl.ItemTemplate>
<DataTemplate>
<Textblock Text="{Binding Path=OldSourceData.MyList[0]}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
However, I need to replace 0
with the alternation index of the current item. I'm using this to get the correct index {Binding Path=(ItemsControl.AlternationIndex), RelativeSource={RelativeSource TemplatedParent}}
How do I replace 0
with the alternation index?
EDIT
I'm trying to figure out how to do something like this: <Textblock Text="{Binding Path=OldSourceData.MyList[{Binding Path=(ItemsControl.AlternationIndex), RelativeSource={RelativeSource TemplatedParent}}]}"/>
Obviously, this syntax doesn't work, however is it possible to accomplish this somehow?