ItemsControl.Items
是否可以通过绑定以某种方式将集合传递给控件中的每个单独项目?
我想要做的看起来像这样(特别是 WorkspaceCubes 绑定):(它目前不起作用,因为您无法绑定到 anItemsControl
或其Items
)
<ItemsControl x:Name="workspace" ItemsSource="{Binding Path=CubeViewModels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas Background="SkyBlue" Margin="0"></Canvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Canvas>
<Sift:CubeView WorkspaceCubes="{Binding ElementName=workspace, Path=Items}" DataContext="{Binding}"></Sift:CubeView>
</Canvas>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>