Timeline.Completed 이벤트

정의

이 Timeline의 재생이 완전히 끝날 때 발생하며, Timeline이 더 이상 활성 기간으로 들어가지 않습니다.

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

이벤트 유형

EventHandler

예제

다음 예제에서는 두 Storyboard 개의 개체를 사용하여 저장하고 컨트롤을 사용하여 ImageSource Image 표시하는 두 이미지 간에 애니메이션 전환을 만드는 데 사용됩니다. 한 스토리보드가 사라질 때까지 이미지 컨트롤을 축소합니다. 완료되면 이전 ImageSource 항목이 다른 ImageSource스토리보드와 교환되고, 이미지 컨트롤이 다시 전체 크기가 될 때까지 이미지 컨트롤을 확장하는 두 번째 스토리보드가 교환됩니다.

<!-- 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>

설명

이 타임라인이 타임라인 트리의 루트 타임라인인 경우 활성 기간(반복 포함)의 끝에 도달하고 모든 자식이 활성 기간의 끝에 도달한 후 재생이 완료되었습니다. 이 타임라인이 자식 타임라인인 경우 해당 타임라인이 속한 타임라인 트리의 루트 타임라인이 활성 기간의 끝에 도달하고 모든 자식 타임라인 재생이 완료되면 재생이 완전히 완료된 것으로 간주됩니다.

타임라인을 중지해도 완료된 이벤트는 트리거되지 않지만 채우기 기간으로 건너뜁니다.

Object 이벤트 처리기의 EventHandler 매개 변수는 타임라인의 Clock.입니다.

이 이벤트 처리기는 타임라인과 연결된 것처럼 보이지만 실제로는 이 타임라인에 대해 생성된 이벤트 처리기에 Clock 등록됩니다. 자세한 내용은 타이밍 이벤트 개요를 참조하세요.

적용 대상