Wait for animation, render to complete - XAML and C#

Posted by Adam S on Stack Overflow See other posts from Stack Overflow or by Adam S
Published on 2010-06-07T14:31:40Z Indexed on 2010/06/07 14:32 UTC
Read the original article Hit count: 169

Filed under:
|
|
|

Hi all. I have a situation where I am animating part of my XAML application, and I need to wait for the animation AND rendering to complete before I can move on in my code. So far the tail end of my function looks like:

    ProcExpandCollapse.Begin();
    while (ProcExpandCollapse.GetCurrentState() != ClockState.Stopped) { }
}

Which, in theory, will wait until the animation is finished. But it will not wait until the rendering is finished - the thread drawing the application might still not have re-drawn the animation.

The animation is expanding a UIElement, and then the next part of my code uses it's rendered size to do some things. My question then is, how do I wait until my UI Element is re-rendered before moving on?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf