How to animate Opacity of a DropShadowEffect?

后端 未结 2 1564
一整个雨季
一整个雨季 2021-02-14 23:18

I have a WPF project with a border using the following style. The plan is to get the glow effect to fade in when the mouse moves over the border, and fade out when it leaves.

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-14 23:59

    A couple of points to note

    1) You need to be targeting an actual property of Border - You are in effect trying to target the value (DropShadowEffect) of the Effect property, not the property itself.

    2) You need to sort the syntax of the PropertyPath.

    Change your Storyboard.Target property to the following and you should be fine:

    Storyboard.TargetProperty="(Effect).Opacity"
    

    EDIT Working code as noted in comment:

    
        
            
        
        
            
        
    
    

提交回复
热议问题