Is there a quick way to determine if any animation in a WPF control is processing.
I have a treeview where I am animating the expansion of the tree nodes, and I would like to wait until all those animations are complete before scrolling the focused item into view. I'd prefer not to track the progress of all my storyboards independently.
Ideally my pseudo code would look something like this:
myTreeView.ExpandAll(); // I have written this part
while (myTreeView.IsAnimating()) // I need the 'IsAnimating' property or extension method
{
// wait
}
selectedTreeviewItem.BringIntoView(); // I have written this too.
Why not use the storyboard's completed event? You will have to either use an event or a different thread, or you will block the UI thread with your while statement and no animations will play.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With