WPF - Starting animation after another animation is finished in xaml

◇◆丶佛笑我妖孽 提交于 2020-06-13 00:48:55

问题


I am using WPF and I have 2 storyboard animations. I want the second animation to start after the first one is finished. How do I do that in the xaml code?


回答1:


I don't know if it is possible in Xaml, if you can use some code behind you can do something like this:

 <Storyboard x:Name="MyStoryboard" Completed="MyStoryboardCompleted" FillBehavior="Stop">

and in your code behind

private void MyStoryboardCompleted(object sender, EventArgs e)
{
    var thing = this.FindResource("MyOtherStorboard");            
    var OtherSB = (Storyboard)thing;
    OtherSB.Begin();
}


来源:https://stackoverflow.com/questions/34038088/wpf-starting-animation-after-another-animation-is-finished-in-xaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!