你可以用一个
Grid
作为
ItemsPanel
的
ItemsControl
:
<ItemsControl>
<ItemsControl.Items>
<Rectangle Width="50" Height="50" Fill="Blue" />
<Rectangle Width="50" Height="50" Fill="Black" />
<Rectangle Width="50" Height="50" Fill="Yellow" Margin="10,10,0,0" />
</ItemsControl.Items>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
在上面的示例中,这些项按预期相互重叠。