【发布时间】:2012-01-01 08:49:25
【问题描述】:
我有一个包含许多项目的容器类型控件。容器控件定义了一个DataTemplate,其中还包含一个ItemsControl 和一个DataTemplate 用于项目。但是,这些项目需要绑定到容器控件中的某些内容。下面给出一个简化的例子:
<DataTemplate DataType="{x:Type ContainerType}">
<!-- Display of the container stuff-->
<ItemsControl ItemsSource="{Binding Items, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type Item}">
<!-- Display of the item stuff -->
<ComboBox Text="Choose a container-level option..."
ItemsSource="{WHAT GOES HERE?}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
如何将项目级别的内容绑定到容器级别?
【问题讨论】:
标签: wpf data-binding datatemplate