0

here is the story boarding created via blend for windows phone app. It creates an animation for grid by transforming it from top to center position. but the issue is i want to do exact same thing from code behind . tell me how to do it. thanks so kindly help me in converting this code in c# so that i can run animation on this grid from code behind.

<Page.Resources>
    <Storyboard x:Name="Storyboard1">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="SecondaryGrid">
            <EasingDoubleKeyFrame KeyTime="0" Value="3.731"/>

            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="3.731"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="SecondaryGrid">
            <EasingDoubleKeyFrame KeyTime="0" Value="-456.468"/>

            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-7.463"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</Page.Resources>
Kam
  • 109
  • 7
  • 1
    Please make an effort to do this by yourself, rather than simply saying 'tell me how to do it' and then show us what you tried. Search online for examples... like [XAML - How do I create a DoubleAnimationUsingKeyFrames dynamically and play the storyboard with VB?](http://stackoverflow.com/questions/11901998/xaml-how-do-i-create-a-doubleanimationusingkeyframes-dynamically-and-play-the) – Sheridan May 07 '15 at 12:46
  • Also [Using a Storyboard animation on a programatically-added control](http://stackoverflow.com/questions/695782/using-a-storyboard-animation-on-a-programatically-added-control) and [Programmatically creating a Storyboard in a WPF ControlTemplate](http://stackoverflow.com/questions/24433817/programmatically-creating-a-storyboard-in-a-wpf-controltemplate)... plenty more if you actually look. – Sheridan May 07 '15 at 12:48
  • Generally speaking, XAML is just a different syntax to declare a class in the same way you would do in code. What is preventing you from just declaring this all directly in code behind? – heltonbiker May 07 '15 at 12:53

0 Answers0