Timeline.Completed Timeline.Completed Timeline.Completed Timeline.Completed Event

定義

このタイムラインの再生が完全に終了したときに発生します。このタイムラインは、もうアクティブ期間に入りません。Occurs when this timeline has completely finished playing: it will no longer enter its active period.

public:
 event EventHandler ^ Completed;
public event EventHandler Completed;
member this.Completed : EventHandler 
Public Custom Event Completed As EventHandler 

次の例では、2 つStoryboardオブジェクトは、アニメーション遷移を使用して格納されている、2 つのイメージの作成に使用ImageSourceオブジェクトし、を使用して表示、Imageコントロール。In the following example, two Storyboard objects are used to create an animation transition between two images, stored using ImageSource objects and displayed using an Image control. 見えなくなるまで、1 つのストーリー ボードは、イメージ コントロールを縮小します。One storyboard shrinks the image control until it disappears. これが完了したら、古いImageSource他と交換されますImageSource、およびイメージを展開する 2 つ目のストーリー ボードがフル サイズ再びまでを制御します。After it completes, the old ImageSource is swapped with the other ImageSource, and a second storyboard that expands the image control until it is full-sized again.

<!-- TimelineCompletedExample.xaml 
     This example creates an animated transition between
     two images. When the user clicks the Start Transition button,
     a storyboard shrinks an image until it disappears. 
     The Completed event is used to notify the class when this
     storyboard has completed. The code behind file handles
     this event by swapping the image and making it visible again.
-->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SDKSample.TimelineCompletedExample"
  WindowTitle="Timeline Completed Example"
  Loaded="exampleLoaded">
  <Page.Resources>

    <!-- A simple picture of a rectangle. -->
    <DrawingImage x:Key="RectangleDrawingImage">
      <DrawingImage.Drawing>
        <DrawingGroup>
          <GeometryDrawing Brush="White">
            <GeometryDrawing.Geometry>
              <RectangleGeometry Rect="0,0,100,100"  />
            </GeometryDrawing.Geometry>
          </GeometryDrawing>
          <GeometryDrawing Brush="Orange">
            <GeometryDrawing.Geometry>
              <RectangleGeometry Rect="25,25,50,50"  />
            </GeometryDrawing.Geometry>
          </GeometryDrawing>
        </DrawingGroup>
      </DrawingImage.Drawing>
    </DrawingImage>

    <!-- A simple picture of a cirlce. -->
    <DrawingImage x:Key="CircleDrawingImage">
      <DrawingImage.Drawing>
        <DrawingGroup>
          <GeometryDrawing Brush="White">
            <GeometryDrawing.Geometry>
              <RectangleGeometry Rect="0,0,100,100"  />
            </GeometryDrawing.Geometry>
          </GeometryDrawing>
          <GeometryDrawing>
            <GeometryDrawing.Geometry>
              <EllipseGeometry Center="50,50" RadiusX="25" RadiusY="25"  />
            </GeometryDrawing.Geometry>
            <GeometryDrawing.Brush>
              <RadialGradientBrush GradientOrigin="0.75,0.25" Center="0.75,0.25">
                <GradientStop Offset="0.0" Color="White" />
                <GradientStop Offset="1.0" Color="LimeGreen" />
              </RadialGradientBrush>
            </GeometryDrawing.Brush>
          </GeometryDrawing>
        </DrawingGroup>
      </DrawingImage.Drawing>
    </DrawingImage>

    <!-- Define the storyboard that enlarges the image.
         This storyboard is applied using code when
         ZoomOutStoryboard completes. -->
    <Storyboard x:Key="ZoomInStoryboardResource">
      <DoubleAnimation 
        Storyboard.TargetName="AnimatedImageScaleTranform" 
        Storyboard.TargetProperty="ScaleX" 
        Duration="0:0:5" To="1" />
      <DoubleAnimation 
       Storyboard.TargetName="AnimatedImageScaleTranform" 
       Storyboard.TargetProperty="ScaleY" 
       Duration="0:0:5" To="1" />
    </Storyboard>
  </Page.Resources>

  <StackPanel Margin="20" >
    <Border 
      BorderBrush="Gray" BorderThickness="2" 
      HorizontalAlignment="Center" VerticalAlignment="Center">

      <!-- Displays the current ImageSource. -->
      <Image
        Name="AnimatedImage" 
        Width="200" Height="200"
        RenderTransformOrigin="0.5,0.5">
        <Image.RenderTransform>
          <ScaleTransform x:Name="AnimatedImageScaleTranform" 
            ScaleX="1" ScaleY="1" />
        </Image.RenderTransform>
      </Image>
    </Border>


    <!-- This StackPanel contains buttons that control the storyboard. -->
    <StackPanel Orientation="Horizontal" Margin="0,30,0,0">

      <Button Name="BeginButton">Start Transition</Button>
      <Button Name="SkipToFillButton">Skip To Fill</Button>
      <Button Name="StopButton">Stop</Button>

      <StackPanel.Triggers>

        <!-- Begin the storyboard that shrinks the image. After the storyboard
             completes, -->
        <EventTrigger RoutedEvent="Button.Click" SourceName="BeginButton">
          <BeginStoryboard Name="ZoomOutBeginStoryboard">
            <Storyboard x:Name="ZoomOutStoryboard" 
              Completed="zoomOutStoryboardCompleted" FillBehavior="Stop">
              <DoubleAnimation 
                Storyboard.TargetName="AnimatedImageScaleTranform" 
                Storyboard.TargetProperty="ScaleX" 
                Duration="0:0:5" To="0" FillBehavior="Stop" />
              <DoubleAnimation 
               Storyboard.TargetName="AnimatedImageScaleTranform" 
               Storyboard.TargetProperty="ScaleY" 
               Duration="0:0:5" To="0" FillBehavior="Stop" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>

        <!-- Advances ZoomOutStoryboard to its fill period.
             This action triggers the Completed event. -->
        <EventTrigger RoutedEvent="Button.Click" SourceName="SkipToFillButton">
          <SkipStoryboardToFill BeginStoryboardName="ZoomOutBeginStoryboard" />
        </EventTrigger>

        <!-- Stops the storyboard. This action does not
             trigger the completed event. -->
        <EventTrigger RoutedEvent="Button.Click" SourceName="StopButton">
          <StopStoryboard BeginStoryboardName="ZoomOutBeginStoryboard" />
        </EventTrigger>
      </StackPanel.Triggers>
    </StackPanel>
  </StackPanel>
</Page>

注釈

このタイムラインがタイムライン ツリーのルート タイムラインの場合は、アクティブな期間 (を繰り返しを含む) の末尾に達するし、そのすべての子は、アクティブな期間の末尾に到達した後に再生が完了します。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 timeline is a child timeline, 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.

タイムラインを停止しても、completed イベントがトリガーされないは塗りつぶし期間をスキップしています。Stopping a timeline does not trigger its completed event, but skipping it to its fill period does.

Objectのパラメーター、EventHandlerイベント ハンドラーがタイムラインのClockします。The Object parameter of the EventHandler event handler is the timeline's Clock.

このイベント ハンドラーは、タイムラインに関連する表示されますが、実際を登録、Clockこのタイムラインを作成します。Although this event handler appears to be associated with a timeline, it actually registers with the Clock created for this timeline. 詳細については、次を参照してください。、タイミング イベントの概要します。For more information, see the Timing Events Overview.

適用対象