<ItemsControl x:Name="If">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentPresenter x:Name="FixTextInfoContentPresenter">
<ContentPresenter.Content>
<MultiBinding Converter="{StaticResource TextInfoDataToControlConverter}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}"></Binding>
<Binding ElementName="If"/>
</MultiBinding>
</ContentPresenter.Content>
</ContentPresenter>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
在Converters中写相应的转换
ItemsControl con = values[2] as ItemsControl;
int index = con.ItemContainerGenerator.IndexFromContainer(values[1] as ContentPresenter);
标签:控件,Index,ItemsControl,values,ItemControl,con From: https://www.cnblogs.com/HRDK-CADeveloper/p/18399862