Click here to Skip to main content
15,034,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am trying to find a way of adding key frames to storyboard through a binding, but I can't get it to work.

What I have tried:

I have tried the following but I get an error: System.Windows.Markup.XamlParseException

<pre> <BeginStoryboard>
                    <Storyboard RepeatBehavior="Forever">
                      <DoubleAnimationUsingKeyFrames
                Storyboard.TargetName="AnimatedTranslateTransform"
                Storyboard.TargetProperty="X"
                Duration="0:0:6"
                RepeatBehavior="Forever" KeyFrames="{Binding Frames}">
                   
                      </DoubleAnimationUsingKeyFrames>
                      <DoubleAnimationUsingKeyFrames
         Storyboard.TargetName="AnimatedTranslateTransform"
         Storyboard.TargetProperty="Y"
         Duration="0:0:6"
         RepeatBehavior="Forever">
Posted
Updated 25-Feb-21 8:30am

1 solution

</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames

That just "says" you're going to "use" DA key frames; you now have to supply some;

e.g.
</DoubleAnimationUsingKeyFrames>
   <EasingDoubleKeyFrame Value="0" KeyTime="0:0:24">
       <EasingDoubleKeyFrame.EasingFunction>
           <ExponentialEase EasingMode="EaseInOut" />
       </EasingDoubleKeyFrame.EasingFunction>
   </EasingDoubleKeyFrame>
<DoubleAnimationUsingKeyFrames

Then you can think about "binding".

(I generate my key frames in code - since they usually follow a function)
   
v2
Comments
pjank42 25-Feb-21 22:42pm
   
I had hoped that I could add the EasingDoubleKeyFrame (and other frames) through a binding, but I have changed it so it is done in the code behind

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900