WPF StoryBoard Last Complete

HoneyBee 186 Reputation points

a project that slides images.

I got help by referring to various references.

There is one problem.

If you keydown
The page slides.

At this time, the X value is adjusted using animation.

but if you hold down the key
A problem arises.

The page slides repeatedly, but
I can't find the last executed animation.

The StoryBoard's Complete event doesn't help me either.

In an animation that loops while a key is pressed
Finally, I want to fire an event when the last animation completes.

What should I do?

public void RunSlideAnimation(double toValue, double fromValue = 0)  
            if (!(this.PART_Root.RenderTransform is TranslateTransform))  
                this.PART_Root.RenderTransform = new TranslateTransform();  
            var story = AnimationFactory.Instance.GetAnimation(this.PART_Root, toValue, fromValue);  
            if(story.Children.Count > 1)  
                //story.Children.Remove(story.Children[story.Children.Count - 1]);  
            story.Completed += (s, e) =>  
                if (OnPageSlideCompleted != null)  
                    OnPageSlideCompleted(null, null);  


Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,562 questions
{count} votes