画一个 Border 对边框进行投影
<Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Grid> <Border Margin="100" BorderThickness="1" BorderBrush="Blue"> <Border.Effect> <DropShadowEffect Color="#E6EFFC" Direction="320" BlurRadius="10" ShadowDepth="10" /> </Border.Effect> <Grid Background="White"> <TextBlock Text="WPF 边框投影" Margin="50" FontSize="30"/> </Grid> </Border> </Grid> </Window>
Direction 方向根据情况调整
效果图如下