locked
how to start animation without writing code in silverlight website RRS feed

  • Question

  • I can create the animation. And have been able to start one before.  What I want to do is to start the animation without writing code.  Lets say I want to start the animation with a left mouse click or upon page load.  Is there a way to start an animation without writing code?  If so, how?  Thank you in advance. 
    Friday, October 23, 2009 5:32 AM

All replies

  • Hi,
          You can definitely do this using Behaviors. Please follow these steps and let us know if it works for you.

    [Storyboard]
    1. Drag and drop "ControlStoryboardAction" behavior from Asset pane on the LayoutRoot
    2. Select "ControlStoryboardAction" in Object and Timeline panel
    3. In Properties pane, set the storyboard you want to play in the "Storyboard" drop down
    4. Set the "Eventname" property to Loaded
    5. F5

    This will play the storyboard when LayoutRoot is loaded. Similary you can drag and drop the "ControlStoryboardAction" behavior on a button or any other control and play animation on different events.

    [States]
    1. Drag and drop "GotoStateAction" behavior from Asset pane on the LayoutRoot
    2. Select "GotoStateAction" in Object and Timeline panel
    3. In Properties pane, set the state u want to play in the "StateName" drop down
    4. Set the "Eventname" property to Loaded
    5. F5

    HTH

    Regards,
    Navit Saxena
    • Proposed as answer by navits - MSFT Friday, October 23, 2009 6:57 AM
    Friday, October 23, 2009 5:43 AM
  • Hi,
          You can definitely do this using Behaviors. Please follow these steps and let us know if it works for you.

    [Storyboard]
    1. Drag and drop "ControlStoryboardAction" behavior from Asset pane on the LayoutRoot
    2. Select "ControlStoryboardAction" in Object and Timeline panel
    3. In Properties pane, set the storyboard you want to play in the "Storyboard" drop down
    4. Set the "Eventname" property to Loaded
    5. F5

    This will play the storyboard when LayoutRoot is loaded. Similary you can drag and drop the "ControlStoryboardAction" behavior on a button or any other control and play animation on different events.

    [States]
    1. Drag and drop "GotoStateAction" behavior from Asset pane on the LayoutRoot
    2. Select "GotoStateAction" in Object and Timeline panel
    3. In Properties pane, set the state u want to play in the "StateName" drop down
    4. Set the "Eventname" property to Loaded
    5. F5

    HTH

    Regards,
    Navit Saxena
    You have no idea how glad I am that you show me that.  Tough enough trying to remember the code.  Thank you. 
    Friday, October 23, 2009 6:24 AM
  • Can I ask a follow up?  For the life of me I cannot get the hyperlink behavior to work.  I am trying to set it so that on a left click of an image it takes me to a webpage?
    Friday, October 23, 2009 6:36 AM
  • This works fine when the storyboard is defined in the page where the button is, but I want to fire off a storyboard by clicking a button on my main page, however, the storyboard I want is defined inside a component screen on that main page.

    Basically, what I have is a component screen that animates elements inside it. The component screen represents a pop-up menu in a prototype I'm building.

    Making the pop-up appear and disappear is no problem. When I click a button on the main page, I fire off an ActivateStateAction where my pop-up control's Visibility setting goes from Collapsed to Visible. I even have a control inside the screen that can call up to the parent screen's state and 'turn itself back off'.

    Ideally, when the component screen is made Visible on the main screen, I want to fire off the storyboard I created within the pop-up control called 'Intro'

    I can do this within the control by putting this <ei:ControlStoryboardAction Storyboard="{StaticResource Intro}"/> inside an EventTrigger on a button... as long as the button is within the local control screen.

    Is there a way I can reference my Intro storyboard from a button on the main page?

    Something like <ei:ControlStoryboardAction Storyboard="{StaticResource ControlScreenName.Intro}"/> (which doesn't appear to work)

    Or maybe even get the component to know when it is set from Collapsed to Visible so I can bind the animation to that property?

     

    Thanks for any help you can offer!

    -Drew

    Friday, May 21, 2010 5:32 PM
  • Sir,i want to ask a question: how can i pause and stop a Animation while it's going on?
    Friday, August 27, 2010 2:07 PM
  • What if we want to do something like playing a storyboard on StackPanel Visibility Change or Changing a public Boolean property from true to false then what should we do inorder to play the storyboard without any code in CS side
    Wednesday, December 29, 2010 4:54 PM