Skip to main content

Microsoft Silverlight

Answered Question DiscreteDoubleKeyFrame in code.RSS Feed

(0)

Shamresh
Shamresh

Member

Member

9 points

21 Posts

DiscreteDoubleKeyFrame in code.

Hi to all,

How can I create the following XAML below in code? And also what is the relationship between  DiscreteDoubleKeyFrame  and a TimeLine? And in the future where could I find this information?

Thanks

Sham.

Ps XAML code:

 

<Storyboard x:Name="SpriteAnimation" RepeatBehavior="Forever">

<DoubleAnimationUsingKeyFrames Storyboard.TargetName="sprite" Storyboard.TargetProperty="(Canvas.Left)" BeginTime="00:00:00">

<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0"/>

<DiscreteDoubleKeyFrame KeyTime="00:00:00.2000000" Value="-200"/>

<DiscreteDoubleKeyFrame KeyTime="00:00:00.4000000" Value="-400"/>

<DiscreteDoubleKeyFrame KeyTime="00:00:00.6000000" Value="-600"/>

<DiscreteDoubleKeyFrame KeyTime="00:00:00.8000000" Value="0"/>

</DoubleAnimationUsingKeyFrames>

</Storyboard>

Jim Mangaly
Jim Mangaly

Contributor

Contributor

2622 points

381 Posts

Answered Question

Re: DiscreteDoubleKeyFrame in code.

Do you really need to create the animation in code? You could define the animation in XAML, and control it in code as demonstrated in this article. If you really need to do this in code, check this post for an example. 

The Timeline class is the base class for all animation classes including the DoubleAnimation UsingKeyFrames class.

Hope this helps,
Jim (http://jimmangaly.blogspot.com/)

Please MARK the replies as answers if they answered your question

http://www.identitymine.com/
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities