答案 0 :(得分:1)
如果你想让Control 1 高于 Control 2并且不包含在它中,请将它们放在网格中,并为Control 1提供更高的ZIndex:
<Grid>
<Control1 Grid.ZIndex="2" />
<Control2 Grid.ZIndex="1" />
<Control3 Grid.ZIndex="1" />
</Grid>
Here is the MSDN供参考。
答案 1 :(得分:1)
不,如果没有丑陋的边距操作,你不能在DockPanel中这样做。 1和2应该在Canvas中:
<Canvas x:Name="canvas">
<Grid>
<!-- usercontrol 1-->
<TextBlock Text="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
<DockPanel Background="Transparent"
Height="{Binding ActualHeight, ElementName=canvas}"
Width="{Binding ActualWidth, ElementName=canvas}">
<!-- usercontrol 2-->
<TextBlock Text="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</DockPanel>
</Canvas>