Using TemplateBinding in ObjectAnimationUsingKeyFrames

后端 未结 2 1050
不思量自难忘°
不思量自难忘° 2021-01-24 05:52

I try to set the background color of a control when mouse is over it. I try to do it via the visual state manager. I was able to get the following code running:

         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-24 06:16

    You cannot do it dynamically on a single target, but what you can do is create another target (for example called BorderBackgroundAlt) whose background you can explicitly set to {TemplateBinding Tag} in its declaration.

    Then you can have BorderBackgroundAlt collapsed by default, and in your animation frame instead of switching colors, switch visibilities, such that BorderBackground is collapsed and BorderBackgroundAlt is visible.

提交回复
热议问题