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?
精彩评论