I'm trying to animate the opacity of an element so that it smoothly fades in and out when the mouse enters or leaves it. This is very simple in WPF using the HandoffBehavior property. I'm it this manually for each animation in code-behind for now but its
ugly. Is there a simple way in xaml?
Daniel, Silverlight has a superior way of handling these type of state animations through the
VisualStateManager (in fact, WPF 4 will be following suite and implementing the VSM). Granted, there is a bit of initial work that will need to be done to give you the control that you desire; namely, you will need to override the control template of the
particular element you wish to implement these animations on. However, it is a powerful way to accomplish this sort of thing at a control level.
Examine the following ControlTemplate (targeted at a Button control), and see if this doesn't point you in the correct direction:
dmacdonald
Member
22 Points
17 Posts
storyboard HandoffBehavior?
Jul 01, 2009 11:21 PM | LINK
Hi,
I'm trying to animate the opacity of an element so that it smoothly fades in and out when the mouse enters or leaves it. This is very simple in WPF using the HandoffBehavior property. I'm it this manually for each animation in code-behind for now but its ugly. Is there a simple way in xaml?
Thanks,
Daniel
elmore.adam
Member
482 Points
67 Posts
Re: storyboard HandoffBehavior?
Jul 03, 2009 07:48 PM | LINK
Examine the following ControlTemplate (targeted at a Button control), and see if this doesn't point you in the correct direction:
Kind Regards
Adam Elmore
MCTS: WPF, WCF
417.200.4261
elmore.adam@gmail.com
http://adamelmore.net/