Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Animations have a property called <strong>FillBehavior</strong>, the default value is <strong>HoldEnd</strong>. </p> <p>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.</p> <p>You can set <strong>FillBehavior</strong> to <strong>Stop</strong> to make the animations stop covering the property when they are done.</p> <p>In your case, setting FillBehavior to Stop on your MouseOutAnimation and MouseUpAnimation does the trick.</p> <p>(In this example set on the storyboard so it applies to all the contained animations.)</p> <pre><code>&lt;ControlTemplate.Resources&gt; &lt;Storyboard x:Key="MouseOverAnimation" Storyboard.TargetProperty="Color"&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" To="#ffefefff" Duration="0:0:0.2" /&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" To="#ffc7c7ff" Duration="0:0:0.2" /&gt; &lt;/Storyboard&gt; &lt;Storyboard x:Key="MouseOutAnimation" Storyboard.TargetProperty="Color" FillBehavior="Stop"&gt; &lt;!-- &lt;=================== --&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" To="#ffeeeeee" Duration="0:0:0.2" /&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" To="#ffcccccc" Duration="0:0:0.2" /&gt; &lt;/Storyboard&gt; &lt;Storyboard x:Key="MouseDownAnimation" Storyboard.TargetProperty="Color"&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" To="#ffc7c7ff" Duration="0:0:0.1" /&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" To="#ff9a9aff" Duration="0:0:0.1" /&gt; &lt;/Storyboard&gt; &lt;Storyboard x:Key="MouseUpAnimation" Storyboard.TargetProperty="Color" FillBehavior="Stop"&gt; &lt;!-- &lt;=================== --&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" To="#ffefefff" Duration="0:0:0.1" /&gt; &lt;ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" To="#ffc7c7ff" Duration="0:0:0.1" /&gt; &lt;/Storyboard&gt; &lt;/ControlTemplate.Resources&gt; </code></pre> <p>You can find more info on FillBehavior in the MSDN article Animation Overview under <a href="http://msdn.microsoft.com/en-us/library/ms752312.aspx#fillbehaviorsection" rel="noreferrer">What Happens After an Animation Ends?</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload