我有以下 XAML:
<ItemsControl ItemsSource="{Binding DataContext}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:MyControl DataContext="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
如何将DataContextof设置MyControl为 的单个项目ItemsControl?
注意: ItemsControl嵌入在UserControl. UserControl它的属性DataContext设置在它被使用的地方。