views:

91

answers:

1

I have a WPF storyboard that I want to step through frame-by-frame (for a variable framerate). At each frame my intention is to story a bitmap of the drawn storyboard state. To this end I am trying to employ the following method:

this.CurrentStoryboard.Begin(this);
this.CurrentStoryboard.Pause(this);
//call a function (SEEKFUNC) which calls the following method for (increasing "frameNumber"s):
this.CurrentStoryboard.Seek(this, TimeSpan.FromSeconds(((double)frameNumber) / c_FrameRate), TimeSeekOrigin.BeginTime);
//wait for drawing to complete at point
SaveFrame(this.saveCanvas);
//call SEEKFUNC with frameNumber++

What I am struggling with however is finding out when the Storyboard has completed and been rendered. Can I assume that this will have been successfully completed by the second subsequent call to CompositionTarget.Rendering? Is there another, neater way?

+1  A: 

Take a look at this: http://blogs.msdn.com/saveenr/archive/2008/09/22/wpf-xaml-saving-an-animation-as-an-avi-video-file.aspx

From that code it looks like calling UpdateLayout will finish seeking the animation.

Nir