我有一个用户控件,里面有一个依赖属性。在我的窗口中,我有一个对象列表,并创建了一个由我的用户控件组成的均匀网格。我将ItemsSource设置为我的对象列表,但需要将每个对应的对象传递给用户控件。请参见下面的代码 - 我需要将Participant对象传递给LadderControl。
<ItemsControl Grid.Row="2" Name="Participants" ItemsSource="{Binding Path=MyEvent.Participants}">
// more code here, irrelevant
<ItemsControl.ItemTemplate>
<DataTemplate>
<ladder:LadderControl Participant="CURRENT_ITEM_IN_PARTICIPANTS_LIST"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
有没有办法我可以做到这一点?我应该考虑使用不同的模式吗?
谢谢