0

ItemsControl.Itemsバインディングを介してコントロール内の個々のアイテムにコレクションを渡すことは可能ですか?

私がやりたいことは次のようになります (具体的には WorkspaceCubes バインディング): (ItemsControlまたはそのにバインドできないため、現在は機能しません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>
4

1 に答える 1

0

あなたの目的はわかりませんが、試してみることができます:

<ItemsControl x:Name="workspace" ItemsSource="{Binding Path=CubeViewModels}" DataContext="{Binding Path=CubeViewModels}"> 
    <ItemsControl.ItemsPanel> 
        <ItemsPanelTemplate> 
            <Canvas Background="SkyBlue" Margin="0"></Canvas> 
        </ItemsPanelTemplate> 
    </ItemsControl.ItemsPanel> 
    <ItemsControl.ItemTemplate> 
        <DataTemplate> 
            <Canvas> 
                <Sift:CubeView WorkspaceCubes="{Binding}"></Sift:CubeView> 
            </Canvas> 
        </DataTemplate> 
    </ItemsControl.ItemTemplate> 
</ItemsControl> 
于 2012-04-27T03:29:17.193 に答える