开发者

Wait for all WPF animations to stop

开发者 https://www.devze.com 2022-12-26 03:54 出处:网络
Given a WPF window, which may or may not have animations, I\'d like to wait until they are all done before continuing processing.Is there a generic开发者_运维技巧 way to do this.Currently I can do som

Given a WPF window, which may or may not have animations, I'd like to wait until they are all done before continuing processing. Is there a generic开发者_运维技巧 way to do this. Currently I can do something like this:

void WaitForAnimation(Storyboard storyboard)
{
    WaitUntil(() => storyboard.GetCurrentState() == ClockState.Stopped);
}

But this assumes I know the storyboards or have some way of finding them. Is there a way of doing that?


A suggestion is that use Storyboard.Completed event to find out the completion of each story board.


Why not just give your storyboards a x:Name and put them into a collection in codebehind? How many of them have you got?

0

精彩评论

暂无评论...
验证码 换一张
取 消