如果你为一个Border指定一个DropShadowEffect ,那么所有Border 里面的子元素都会获得立体阴影。
<Border Margin="10" BorderBrush="Black" BorderThickness="1">
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
<StackPanel Orientation="Vertical" Margin="5">
<Label Content="Staying within borders"/>
<Button Content="Do It"/>
</StackPanel>
</Border>
效果如图
如果你想阴影仅仅只是围绕在Border周围,而不是每个子元素都有阴影。你可以创建两个双生的Border ,一个用来显示子元素,但是没有阴影;一个在相同的地方,没有任何子元素,但是用来显示阴影。
<Grid>
<Border Margin="10" BorderBrush="Black" BorderThickness="1" Background="White">
<Border.Effect>
<DropShadowEffect ShadowDepth="2"/>
</Border.Effect>
</Border>
<Border Margin="10" BorderBrush="Black" BorderThickness="1">
<StackPanel Orientation="Vertical" Margin="5">
<Label Content="Staying within borders"/>
<Button Content="Do It"/>
</StackPanel>
</Border>
</Grid>

原文地址:https://wpf.2000things.com/2011/11/23/436-using-a-drop-shadow-with-a-border/