How to seek a WPF Storyboard to a specific frame/time offset when not running – Education Career Blog

I wish to seek to a specific time or frame using the ClockController.SeekAlignedToLastTick – however this does not appear to do anything, unless the Storyboard is running.
I dont want to have to ‘start’ the storyboard, because I only intend the Storyboard to set all dependencyproperty values, and have everything lay-out for that time position, so that I can take a snapshot and advance to the next frame (I could respond to clock events and capture the frame, but then I couldnt guarantee I would get my snapshots at the correct times that I want).

How can I simply advance a WPF storyboard to a specific position without ‘running’ it?

Thanks!

,

You’ll have to at least begin the animation before you can seek into it. You can however begin then pause right away, and seek.

// sb is a Storyboard
sb.Begin();
sb.Pause();
sb.SeekAlignedToLastTick(sometimespan);

Leave a Comment