次の 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>
DataContext
のMyControl
を の 1 つのアイテムに設定するにはどうすればよいItemsControl
ですか?
注: ItemsControl
に埋め込まれていUserControl
ます。には、使用されている場所に設定されたプロパティがありますUserControl
。DataContext