This documentation is archived and is not being maintained.

TimelineGroup Class

Abstract class that, when implemented represents a Timeline that may contain a collection of child Timeline objects.

Namespace:  System.Windows.Media.Animation
Assembly:  PresentationCore (in PresentationCore.dll)

<ContentPropertyAttribute("Children")> _
Public MustInherit Class TimelineGroup _
	Inherits Timeline _
	Implements IAddChild
Dim instance As TimelineGroup
This class is abstract; see Inheritance Hierarchy for derived non-abstract classes usable in XAML.

A TimelineGroup can be a child of another TimelineGroup.

This example shows how to simplify animations by using child ParallelTimeline objects. A Storyboard is a type of Timeline that provides targeting information for the timelines it contains. Use a Storyboard to provide timeline targeting information, including object and property information.

To begin an animation, use one or more ParallelTimeline objects as nested child elements of a Storyboard. These ParallelTimeline objects can contain other animations and therefore, can better encapsulate the timing sequences in complex animations. For example, if you are animating a TextBlock and several shapes in the same Storyboard, you can separate the animations for the TextBlock and the shapes, putting each into a separate ParallelTimeline. Because each ParallelTimeline has its own BeginTime and all child elements of the ParallelTimeline begin relative to this BeginTime, timing is better encapsulated.

The following example animates two pieces of text (TextBlock objects) from within the same Storyboard. A ParallelTimeline encapsulates the animations of one of the TextBlock objects.

Performance Note: Although you can nest Storyboard timelines inside each other, ParallelTimelines are more suitable for nesting because they require less overhead. (The Storyboard class inherits from the ParallelTimeline class.)

<Page xmlns="" 
  <Canvas >

    <!-- TextBlock with text "ParallelTimelines are..." that gets animated. -->
    <TextBlock Name="FirstTextBlock" Canvas.Top="30" Canvas.Left="300" FontSize="24" >
      ParallelTimelines are...
          <SkewTransform x:Name="FirstTextBlockSkew" CenterX="25" CenterY="25" AngleX="0" AngleY="0" />

    <!-- TextBlock with text "Useful" that gets animated. -->
    <TextBlock Name="SecondTextBlock" Opacity="0" Canvas.Top="30" Canvas.Left="585" FontSize="24" >
          <SkewTransform x:Name="SecondTextBlockSkew" CenterX="25" CenterY="25" AngleX="0" AngleY="0" />
          <ScaleTransform x:Name="SecondTextBlockScale" CenterX="0" CenterY="24" />

    <!-- Event Trigger that controls all animations on the page. -->
      <EventTrigger RoutedEvent="Canvas.Loaded">

            <!-- "ParallelTimelines are..." fades into view. -->
            <DoubleAnimation Storyboard.TargetName="FirstTextBlock"
            Storyboard.TargetProperty="Opacity" Duration="0:0:2" From="0" To="1" />

            <!-- "ParallelTimelines are..." skews to the left. -->
            <DoubleAnimation Storyboard.TargetName="FirstTextBlockSkew"
            Storyboard.TargetProperty="AngleX" Duration="0:0:1" BeginTime="0:0:2" From="0" To="45" />

            <!-- This ParallelTimeline contains all the animations for the TextBlock with the text
            "Useful" in it. This ParallelTimeline begins 4 seconds after the Storyboard timeline begins and all child
            animations begin relative to this parent timeline. -->
            <ParallelTimeline BeginTime="0:0:4">

              <!-- "Useful" fades into view. -->
              <DoubleAnimation Storyboard.TargetName="SecondTextBlock"
              Storyboard.TargetProperty="Opacity" Duration="0:0:2" From="0" To="1" />

              <!-- "Useful" slides in from the right. -->
              <DoubleAnimation Storyboard.TargetName="SecondTextBlockSkew"
              Storyboard.TargetProperty="AngleX" Duration="0:0:2" From="90" To="180" />

              <!-- "Useful" skews to the right. -->
              <DoubleAnimation Storyboard.TargetName="SecondTextBlockSkew"
              Storyboard.TargetProperty="AngleX" BeginTime="0:0:3" Duration="0:0:0.2" From="0" To="-60" />

              <!-- "Useful" Gets taller. -->
              <DoubleAnimation Storyboard.TargetName="SecondTextBlockScale"
              Storyboard.TargetProperty="ScaleY" BeginTime="0:0:3" Duration="0:0:0.2" From="1" To="3" />

More Code

How to: Animate a Property by Using a Storyboard This example shows how to use a Storyboard to animate properties. To animate a property by using a Storyboard, create an animation for each property that you want to animate and also create a Storyboard to contain the animations.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0