none
Storyboard BeginTime property confusion

    Question

  • There is a general workaround for being able to fire events on EventTriggers that are not "Canvas.Loaded" that involves setting the BeginTime to a large number so it doesn't get run immediately (then you can fire it with JScript whenever you like).

    Here is my issue:

    The docs seem to imply that I can use "Forever" instead of an artibirary large number to make the Storyboard wait a number of days.  WHat is the recommended way of suggesting how this workaround should be implemented?

    Wednesday, January 03, 2007 8:32 AM

Answers

  • Setting the BeginTime of a Storyboard to a large value is a temporary workaround to enable, on the Dec CTP bits, animations that don't start on page load.  The main scenario are interactive animations that happen in response to some user input.

    The recommended way of doing so is to set the BeginTime of your root Storyboard to 1 day:

    <BeginStoryboard>
      <
    Storyboard BeginTime="1" x:Name="mySB1">
        <
    ColorAnimation To="Red" Duration="0:0:2.5" Storyboard.TargetName="myRect" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"/>
      </
    Storyboard>
    </
    BeginStoryboard>

    The reason we recommend 1 day instead of something larger is that there are a few known rounding issues if you set a very large BeginTime, where animations don't always end correctly once they are begun.

    We understand this is far from ideal, and we are currently working on a better solution for the interactive animation scenario.  If you have any other input about this, they are greatly appreciated.

    Thanks a lot,
    Ed Maia
    WPF/E PM

     

     

    Monday, January 08, 2007 8:11 PM

All replies

  • I'm interested in getting an answer for this as well since there are many situations where I can see the "Forever" example coming into play.
    Sunday, January 07, 2007 6:32 AM
  • Setting the BeginTime of a Storyboard to a large value is a temporary workaround to enable, on the Dec CTP bits, animations that don't start on page load.  The main scenario are interactive animations that happen in response to some user input.

    The recommended way of doing so is to set the BeginTime of your root Storyboard to 1 day:

    <BeginStoryboard>
      <
    Storyboard BeginTime="1" x:Name="mySB1">
        <
    ColorAnimation To="Red" Duration="0:0:2.5" Storyboard.TargetName="myRect" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"/>
      </
    Storyboard>
    </
    BeginStoryboard>

    The reason we recommend 1 day instead of something larger is that there are a few known rounding issues if you set a very large BeginTime, where animations don't always end correctly once they are begun.

    We understand this is far from ideal, and we are currently working on a better solution for the interactive animation scenario.  If you have any other input about this, they are greatly appreciated.

    Thanks a lot,
    Ed Maia
    WPF/E PM

     

     

    Monday, January 08, 2007 8:11 PM