locked
Storyboard Animation Completed Event (VB 2013)

    Question

  • Hi all,

    I am very new to VB so I was wondering if you could get me an easy reply on that.

    I want to start a second Storyboard animation after the first one is completed but I do not know how to define the event trigger, this is my code, Thanks a lot:

    Dim mystoryboard As New Animation.Storyboard
        Dim animationX As New Animation.DoubleAnimation
        Dim animationY As New Animation.DoubleAnimation
        Dim moveTransform As New TranslateTransform

        Dim duration As Duration

    Dim rectangle as new shapes.rectangle

            moveTransform.X = 0
            moveTransform.Y = 0
            rectangle.RenderTransform = moveTransform

            duration = New Duration(TimeSpan.FromSeconds(5))
            animationX.Duration = duration
            animationY.Duration = duration
            mystoryboard.Duration = duration

            animationX.From = 0
            animationX.To = 200
            animationY.From = 0
            animationY.To = 200

            mystoryboard.Children.Add(animationX)
            mystoryboard.Children.Add(animationY)

            Animation.Storyboard.SetTarget(animationX, moveTransform)
            Animation.Storyboard.SetTarget(animationY, moveTransform)
            Animation.Storyboard.SetTargetProperty(animationX, "X")
            Animation.Storyboard.SetTargetProperty(animationY, "Y")

            GridMain.Resources.Add("mystoryboard", mystoryboard)

            mystoryboard.Begin()

    Monday, August 11, 2014 8:40 PM

Answers

  • Hi Problem449,

    Take a look at the documentation: Storyboarded animations:

    You can handle the Completed event if you want other logic to run after the animation has finished applying values. Also, for troubleshooting property system/animation interactions, the GetAnimationBaseValue method can be useful.

    Completed event can be fired for your scenario.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 12, 2014 1:38 AM
    Moderator