Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight 3
Timeline Class
Timeline Events
 Completed Event
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Silverlight 3

Other versions are also available for the following:
.NET Framework Class Library for Silverlight
Timeline..::.Completed Event

Occurs when the Storyboard object has completed playing.

Namespace:  System.Windows.Media.Animation
Assembly:  System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public Event Completed As EventHandler
Visual Basic (Usage)
Dim instance As Timeline
Dim handler As EventHandler

AddHandler instance.Completed, handler
C#
public event EventHandler Completed
XAML Attribute Usage
<object Completed="eventhandler"/>

If this timeline is the root timeline of a timeline tree, it has completed playing after it reaches the end of its active period (which includes repeats) and all its children have reached the end of their active periods. If this Storyboard is a child Storyboard, it is considered to have completely finished playing when the root timeline of the timeline tree to which it belongs reaches the end of its active period and all its child timelines have finished playing.

Stopping a timeline does not trigger its completed event, but skipping it to its fill period does.

The following example fires the Completed event after a Storyboard ends.

Run this sample

XAML
<Canvas
  Width="200" Height="200"
  Background="White"
  x:Name="Page">
  <Canvas.Triggers>
    <EventTrigger RoutedEvent="Canvas.Loaded">
      <BeginStoryboard>
        <Storyboard x:Name="ColorStoryboard" Completed="onCompleted">

          <!-- Animate the background color of the canvas from red to green
               over 4 seconds. -->
          <ColorAnimation BeginTime="00:00:00" Storyboard.TargetName="Page" 
           Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
           From="Red" To="Green" Duration="0:0:4" />

        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  </Canvas.Triggers>
</Canvas>

JScript
function onCompleted(sender, eventArgs)
{

  alert("Storyboard has completed!");

}

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker