I have a problem with controlling the instance of the class Storyboard.
It's defined in XAML in Resources:
<Window.Resources>
<Storyboard x:Name="Storyboard1" x:Key="Storyboard1">
Also I'm trying to make it stop, like this:
Storyboard sb = (Storyboard)this.TryFindResource("Storyboard1");
sb.Seek(TimeSpan.Zero);
But, no success. If I try to call in your code to the instance Storybord1 then I've got the errors, that there is NO such instance in the current context (and also, if in C# code I try to look with intellisense also no succes, cause of describing pervious problem).
When I'm trying to find this instance with:
foreach (var item in this.Resources)
{
MessageBox.Show(item.ToString());
}
No success.
I'm not doing smth difficult or using super-encapsulated design pattern, that I can't find/use it.
Just add one UI element and one Storyboard with changing opacity.
I want just to control by myself all Storyboard's play. When I can Stop it and Start it.
In Silverlight I don't get any troubles ( cause Storyboard1 is accessible in Silverlight ), but in WPF all storyboards by defualt are auto-playing and I can't control the its instances.
How can I solve it?
Thank you!