views:

19

answers:

0

Let's say I have a custom control that I want to animate on loading and closing. I have overridden its ControlTemplate and provided Storyboards for show/hide animations. Loading is handled with EventTrigger on Framework.Loaded and closing on a custom event. This all works well.

Now I have a series of images that I want to display consecutively one after another effectively creating an animation prior to "loading" and after "closing". Basically, closing is just a reverse of loading.

I have created a new top-level Grid in my custom control and placed "old" custom control visuals along with an <Image /> in this new Grid. The idea is to only show either the Image or the "main content" at any time. Each loading and closing should now consist of a single Image animation and a single "main content" animation - probably two Storyboards one after another.

I am having huge problems setting Visibilty from a Storyboard. So far I have used ObjectAnimationUsingKeyFrames and a single DiscreteObjectKeyFrame. Even though this appears to work well, as soon as I add Visibility animation in a second Storyboard, it appears as if the first one is no longer doing what it should. Both Storyboards are in the same EventTrigger. Second one's BeginTime is exactly the Duration of the first one.

I haven't worked with animations that much so far, at least not complex ones with multiple Storyboards. I would appreciate any help or suggestions as I have spent hours on this without a light in the tunnel. Are there any special considerations or common pitfalls when it comes to consecutive Storyboards? Or should all animations simply be a part of the same Storyboard?