tags:

views:

529

answers:

2

I have a Storyboard that animates an Ellipse on a navigation:Page control. As long as I keep the Storyboard local inside the UserControl.Resources the animation runs with no problem.

I moved the Storyboard into a Resource Dictionary to make it available to multiple pages. I can access the Storyboard as expected, but the application throws an exception when the Storyboard attempts to locate the element to animate. I get a 'Cannot resolve TargetName' error.

My guess is that since this is a Silverlight navigation application the Storyboard needs to know about the application hierarchy to get to the page to find the final target - I just don't know how to make that happen :)

A: 

Does it use any inherited styles? I havehad this exact problem when using inherited styles. If I move it all to the same resource dictionary or all in the user control, it then works fine.

If not, post a code sample and I can take a look.

John Papa
I tried adding my StoryBoard to the Styles.xaml file that was pre-defined as a ResourceDictionary, but that didn't seem to work.I have pasted my code here for you to take a look at: http://codepaste.net/xwq6bnI am guessing that the best way to deal with this is to just add the glyph and the StoryBoard into a user control and just reuse that in the application. Does that sound appropriate?
Craig Shoemaker
A: 

Storyboard story = (Storyboard)ResourceManager.GetObjectFromResource((ResourceDictionary)this.Resources["res1"], "Canvas_BodySide_Visible"); story.Begin();

but cannot resolve targetname.

how i resolve it.

boroo