Binding EasingColorKeyFrame value to control property


  • I have an animation that quickly changes the background of a custom control. Originally all the values for the EasingColorKeyFrames where set to static resource properties. I'm attempting to change these values to use a Color dependency property of the control but it does not seem to be working. Below is my StoryBoard definition

    <Storyboard x:Name="PadFlash">
       <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Pad">
          <EasingColorKeyFrame KeyTime="0:0:0.0" Value="#FFBB9F8F"/>
          <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{Binding RelativeSource={RelativeSource Self}, Path=CurrentColor}"/>

    The control background that I'm animating can have it's background configured at runtime and I need my animation to quickly flash a highlighting color then return to the background of the control. Since the control background is configurable the animation value for the last EasingColorKeyFrame needs to be dynamic and use the CurrentColor property as its value. CurrentColor is a dependency property of the control and is working correctly in code behind but not in this animation. When the animation occurs the highlight color appears then the control background turns to black and I can tell from debugging that the getter of the dependency property is not being called.

    Is it possible to use a dependency properties for EasingColorKeyFrame animation values?

    Monday, February 09, 2015 5:14 AM

All replies