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.SkipToFill(this);
//story.Children.Remove(story.Children[story.Children.Count - 1]);
}
story.Completed += (s, e) =>
{
this.RefreshViewPort(this.SelectedIndex);
//Debug.WriteLine("Finish");
if (OnPageSlideCompleted != null)
{
OnPageSlideCompleted(null, null);
}
};
story.Begin();
}
Sign in to answer