边框设置像一叠卡片

border set like stack of cards

我想知道解决此问题的最佳方法是什么我有一个文本块,其边框周围有一个图像,我可以添加属性,我想在它周围添加一个边框,就像一叠卡片一样。我会用图片来证明我的意思。我的第一张图是刚才显示的。

第二张图片是我想要它显示的,如果在这个例子中添加了属性,那么将添加 5 个属性。

使用许多重叠的边框,背景不透明。

xaml出场顺序为绘画顺序。

因此最后一个组件出现在第一个组件之上。

所有组件都在允许许多 children 的网格中。

<Grid>
    <Grid.Resources>
        <system:Double x:Key="width1" >100</system:Double>
        <system:Double x:Key="height1" >30</system:Double>
    </Grid.Resources>

    <Border BorderThickness="1" BorderBrush="Gray"             
            Background="White"
            Margin="120 80 0 0" 
            Width="{StaticResource width1}"
            Height="{StaticResource height1}" />

    <Border BorderThickness="1" BorderBrush="Gray"             
            Background="White"
            Margin="110 90 0 0" 
            Width="{StaticResource width1}"
            Height="{StaticResource height1}" />

    <TextBlock Text="+6" 
               Padding="20 7 0 0"
               Margin="100 100 0 0"
               Background="Gray"
               Width="{StaticResource width1}"
               Height="{StaticResource height1}"/>

</Grid>

注意:使用资源为所有组件设置相同的大小

此致