Animations have a property called FillBehavior the default value is HoldEnd .
Up vote 2 down vote favorite 1 share g+ share fb share tw.
I'm making my own ControlTemplate for a standard Button in WPF. I want to change the background of my button when the user hovers over the button with the mouse, but also when the user presses the button (to yet another color). This seems like a common behavior, but I can't get it to work.
My template consists of a Border with an Image inside. It is the background color (a gradient really) of the Border that I want to animate. I have triggers in my template that activates animations (storyboards).
The MouseOver/Out works just fine. My problem occurs when I press the button. The Press animation runs as it should, and so does the Release animation.
But after this the MouseOut will never run. The button gets stuck in the MouseOver state. What am I doing wrong?
Wpf xaml animation link|improve this question asked Mar 12 '10 at 12:53haagel275211 62% accept rate.
Animations have a property called FillBehavior, the default value is HoldEnd. After your MouseUp animation finishes, it holds the value preventing the mouse out animation from displaying properly. The mouse out animation actually does run, but is covered by the mouse up animation.
If you flip the order of your triggers, putting IsPressed first, you can see that the IsMouseOver animation covers all the IsPressed animations. You can set FillBehavior to Stop to make the animations stop covering the property when they are done. In your case, setting FillBehavior to Stop on your MouseOutAnimation and MouseUpAnimation does the trick.
(In this example set on the storyboard so it applies to all the contained animations. ) You can find more info on FillBehavior in the MSDN article Animation Overview under What Happens After an Animation Ends?.
That solved my problem. Very informative answer! Thank you very much omdsmr! :) – haagel Mar 12 '10 at 15:03.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.