Stop WPF animation, storyboard begin in xaml but stopping it in codebehind?

后端 未结 3 567
北荒
北荒 2020-12-01 16:59

I created an animation storyboard in xaml file. That story board begins on Button.Click. But to stop the animation I am trying to stop storyboard on my custom event in code

3条回答
  •  春和景丽
    2020-12-01 17:54

    I solve the problem with using the Stop() method of Storyboard class like this

    myStoryBoard.Stop(this.LayoutRoot);
    

    with this solution you don't have to declare Storyboard at the resource.

提交回复
热议问题