Expression blend operation: Use Behavior to control storyboard

Source: Internet
Author: User

Blend is a powerful tool for WPF/SL developers. You can draw shapes, paths, and controls on the art panel, modify their appearances and behaviors, and import images, videos, and sounds. Today, I will show you how to use the controlstoryboardaction action in blend to control the storyboard ). The environment is blend3 + win7.

1. Open blend and create a WPF project. The default value is wpfapplication1. for example:

 

2. Use blend to create a simple animation

1> first, select the blend workspace as "Animation", switch the shortcut key to F6, and open the "window/workspace/animation" method ". For example:

 

2> select "elliptical" in "Tools", or click "control" on the left in "assets" and select "elliptical". For example:

 

3> drag two ovans to the terraform and fill one of them in red. For example:

 

4> select a blank oval, right-click, and select "path/to convert to motion path". For example:

5> in this case, the "convert to motion path" dialog box appears, select a red ellipse, and click OK. Blend generates a scenario feed for us. Click "play" to view the animation effect immediately. For example:

6> close the storyboard1 synopsis, for example:

7> click "behavior" in "assets", select "controlstoryborardaction", and drag it to the red elliptical node in "object and timeline. For example:

8> click "controlstoryboardaciton" and select "attribute", for example:

9> sourcename is the trigger object of the event. In this demonstration, it is a red oval; eventname is the name of the trigger event, which is left-click in this demo; controlstoryboardoption is the control of the plot feed, play or stop is available. In this demo, play is used; storyboard is the storyboard to be controlled. In this demo, select storyboard1. in general, click the red oval, start playing the synopsis storyboard1, that is, let the Red elliptical start to rotate.

10> RUN F5. Click the red oval to see what you want. For example:

(P.s. you will surely find that the animation starts playing as soon as the program is started, because when blend just created storyboard1 for us, it was in mainwindow. when a trigger event is created in XAML, you can delete the Code as follows:

<Window.Triggers>    <EventTrigger RoutedEvent="FrameworkElement.Loaded">        <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>    </EventTrigger></Window.Triggers>

OK. Through this demonstration, I believe everyone will use controlstoryboardaction to control the storyboard in blend.

References: Control storyboards Easily Using Behaviors

Project Demo: sourcecode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.