How to animate Opacity of a DropShadowEffect?

后端 未结 2 1514
心在旅途
心在旅途 2021-02-14 23:34

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-15 00:07

    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:

    
        
            
        
        
            
        
    
    

提交回复
热议问题