Wpf 边界的外部辉光效果

Wpf 边界的外部辉光效果,wpf,border,glow,bitmapeffect,Wpf,Border,Glow,Bitmapeffect,如何为边框提供外部辉光效果 <Grid Width="200" Height="200"> <Grid.Background> <RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5" RadiusX="0.8" RadiusY="0.8"> <RadialGradientBrush.GradientStops>

如何为边框提供外部辉光效果

<Grid Width="200" Height="200">
    <Grid.Background>
        <RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5" RadiusX="0.8" RadiusY="0.8">
            <RadialGradientBrush.GradientStops>
                <GradientStop Offset="0" Color="#FF123B5F" />
                <GradientStop Offset="1" Color="#FF001F31" />
            </RadialGradientBrush.GradientStops>
        </RadialGradientBrush>
    </Grid.Background>
    <Border Width="180" Height="180" Margin="10" Background="Transparent"
            BorderBrush="White" BorderThickness="1">
        <Border.BitmapEffect>
            <OuterGlowBitmapEffect GlowColor="White" GlowSize="3" Opacity="1" />
        </Border.BitmapEffect>
    </Border>
</Grid>


我已经尝试过了,但它不起作用。

BitmapEffects
在.NET 4.0中不再受支持

重要信息在.NET Framework 4或更高版本中,BitmapEffect类是 过时的。如果尝试使用BitmapEffect类,您将得到 过时的例外。BitmapEffect的非过时替代方案 类是效果类。在大多数情况下,效果类是 速度明显加快

这与此不同,但您可以尝试使用
DropShadowEffect
,而
ShadowDepth
接近0

范例


比较您拥有的
BitmapEffects
和上面的
DropShadowEffect
<代码>向右放置阴影效果

<Border Width="180" Height="180" Margin="10" Background="Transparent"
        BorderBrush="White" BorderThickness="2" Opacity="1.0">
    <Border.Effect>
        <DropShadowEffect ShadowDepth="0"
                          Color="White"
                          Opacity="1"
                          BlurRadius="5"/>
    </Border.Effect>
</Border>