Click here to Skip to main content
13,511,903 members
Rate this:
Please Sign up or sign in to vote.
I have a problem with controlling the instance of the class Storyboard.

It's defined in XAML in Resources:

    <Storyboard x:Name="Storyboard1" x:Key="Storyboard1">

Also I'm trying to make it stop, like this:

Storyboard sb = (Storyboard)this.TryFindResource("Storyboard1");

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)

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!
Posted 26-Dec-12 2:32am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180417.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100