Roland Rodriguez

Neither of these work in my static method, any ideas

Code Snippet

Storyboard loadAnimation = (Storyboard)Application.Current.FindResource("OnUnloaded1");

//where loadAnimation_Completed is a static event handler

loadAnimation.Completed += new EventHandler(loadAnimation_Completed);

//this fails the same way

loadAnimation.Completed += delegate

{

//do something

};

The error I get is:

"Specified value of type 'System.Windows.Media.Animation.Storyboard' must have IsFrozen set to false to modify."

How can I get a non-frozen instance of my storyboard so I can modify it in my code

TIA,

Roland Rodriguez



Re: Windows Presentation Foundation (WPF) Can't get a non-frozen instance of my storyboard.

Roland Rodriguez

Figured it out. The solution is to use a cloned instance of my storyboard:

Storyboard animation = (Storyboard)this.FindResource("OnUnloaded1");

loadAnimation = animation.Clone();