Outer glow effect to border

后端 未结 1 1500
予麋鹿
予麋鹿 2021-02-02 09:07

How to provide the outer glow effect to border?


    
        

        
相关标签:
1条回答
  • 2021-02-02 09:53

    BitmapEffects are no longer supported in .NET 4.0.

    From MSDN

    Important In the .NET Framework 4 or later, the BitmapEffect class is obsolete. If you try to use the BitmapEffect class, you will get an obsolete exception. The non-obsolete alternative to the BitmapEffect class is the Effect class. In most situations, the Effect class is significantly faster.

    It isn't the same thing but you can try with a DropShadowEffect with ShadowDepth close to 0 instead.

    Example

    <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>
    

    Comparison between the BitmapEffects you had and DropShadowEffect above. DropShadowEffect to the right.

    enter image description here

    0 讨论(0)
提交回复
热议问题