1

I've created a project in Visual Studio and I opened it in Blend so I can do some animations.

I've created two animation using the StoryBoard and associated every animation to a different button (in the Clic action).

My problem is that the the two animations are starting when I launch the application, and what I want to do is to stop them until the button is triggered.

How can I achieve that ?

EDIT

This is my source code.

<s:SurfaceWindow.Resources>
<Storyboard x:Key="StoryboardStart" x:Name="SBStrt">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="image">
        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="StoryboardStop" x:Name="STStp">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="image">
        <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0"/>
        <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

And in the .cs constructor I have this

public SurfaceWindow1()
{
    InitializeComponent();

    // Add handlers for window availability events
    AddWindowAvailabilityHandlers();

}

3 Answers 3

2

Maybe the animation starts in the initializecomponent method. Try editing the designer file of the form. Search for the lines that define the StoryBoard and try to find the line that starts the animation.

If you want to disable it, turn it into a comment so you can switch it on later. To answer your question better i'm gonna need some code.

2
  • 1
    i'm not shore but: can you try setting the RepeatBehavior to "0x" or "0:0:0". Like this: RepeatBehavior="0x" on DoubleAnimationUsingKeyFrames. For more info: msdn.microsoft.com/en-us/library/…
    – RTB
    Jun 18, 2012 at 17:36
  • If my answer helped, please accept it. If not what's the status of the problem? Maybe i can help you.
    – RTB
    Jun 28, 2012 at 14:41
1

I think I know what you want..

You can use Control story board action asset which is in under behaviors of expression blend.

You just have to drag a Control story board action on to a button and for this controlstoryboardaction you have to select a event name as left mouse button down.

0

I know where your problem lies. It's within your window XAML file. Go into blend and select your storyboard. Select the animation that is occurring at startup and examine the XAML file the displays in the bottom pane. Within this XAML file look for Window.Triggers and remove the begin storyboard.

![Clear out all contents you dont want to start with your application. Mine has none for instance. ]1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.