canvas面板ZIndex

如果canvas面板有多个互相重叠的元素,可通过设置canvas.ZIndex附加属性来控制他们的层叠方式

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Canvas>
        <Button Canvas.Left="10" Canvas.Top="10" Width="100" Height="100" Canvas.ZIndex="99">123</Button>
        <Button Canvas.Left="100" Canvas.Top="100" Width="100" Height="100"  Canvas.ZIndex="1">456</Button>
    </Canvas>
</Window>