Cet article a fait l'objet d'une traduction manuelle. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. |
Traduction
Source
|
Timeline.Completed, événement
Se produit lorsque cette chronologie est complètement terminée et n'entrera plus dans sa période active.
Assembly : PresentationCore (dans PresentationCore.dll)
XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Si cette chronologie est la chronologie racine d'une arborescence de chronologie, son cycle se termine une fois qu'elle a atteint la fin de sa période active (laquelle inclut les répétitions) et une fois que tous ses enfants ont atteint la fin de leur période active. Si cette chronologie est une chronologie enfant, son cycle est alors considéré comme étant terminé lorsque la chronologie racine de l'arborescence de chronologie à laquelle elle appartient atteint la fin de sa période active et que toutes ses chronologies enfants sont terminées.
L'arrêt d'une chronologie ne déclenche pas son événement Completed, mais son ignorance jusqu'à la période de remplissage le déclenche.
Le paramètre Object du gestionnaire d'événements EventHandler correspond au Clock de la chronologie.
Même si ce gestionnaire d'événements semble être associé à une chronologie, il s'inscrit en fait avec le Clock créé pour la chronologie en question. Pour plus d'informations, consultez Vue d'ensemble des événements de minutage.
Dans l'exemple suivant, deux objets Storyboard sont utilisés pour créer une transition d'animation entre deux images, stockées à l'aide d'objets ImageSource et affichées à l'aide d'un contrôle Image. Une table de montage séquentiel réduit le contrôle d'image jusqu'à ce qu'il disparaisse. Après qu'il se soit terminé, l'ancien ImageSource est échangé avec l'autre ImageSource et une deuxième table de montage séquentiel qui développe le contrôle d'image jusqu'à ce qu'il récupère sa taille normale.
<!-- 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. --><Pagexmlns="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. --><DrawingImagex:Key="RectangleDrawingImage"><DrawingImage.Drawing><DrawingGroup><GeometryDrawingBrush="White"><GeometryDrawing.Geometry><RectangleGeometryRect="0,0,100,100"/></GeometryDrawing.Geometry></GeometryDrawing><GeometryDrawingBrush="Orange"><GeometryDrawing.Geometry><RectangleGeometryRect="25,25,50,50"/></GeometryDrawing.Geometry></GeometryDrawing></DrawingGroup></DrawingImage.Drawing></DrawingImage><!-- A simple picture of a cirlce. --><DrawingImagex:Key="CircleDrawingImage"><DrawingImage.Drawing><DrawingGroup><GeometryDrawingBrush="White"><GeometryDrawing.Geometry><RectangleGeometryRect="0,0,100,100"/></GeometryDrawing.Geometry></GeometryDrawing><GeometryDrawing><GeometryDrawing.Geometry><EllipseGeometryCenter="50,50"RadiusX="25"RadiusY="25"/></GeometryDrawing.Geometry><GeometryDrawing.Brush><RadialGradientBrushGradientOrigin="0.75,0.25"Center="0.75,0.25"><GradientStopOffset="0.0"Color="White"/><GradientStopOffset="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. --><Storyboardx:Key="ZoomInStoryboardResource"><DoubleAnimationStoryboard.TargetName="AnimatedImageScaleTranform"Storyboard.TargetProperty="ScaleX"Duration="0:0:5"To="1"/><DoubleAnimationStoryboard.TargetName="AnimatedImageScaleTranform"Storyboard.TargetProperty="ScaleY"Duration="0:0:5"To="1"/></Storyboard></Page.Resources><StackPanelMargin="20"><BorderBorderBrush="Gray"BorderThickness="2"HorizontalAlignment="Center"VerticalAlignment="Center"><!-- Displays the current ImageSource. --><ImageName="AnimatedImage"Width="200"Height="200"RenderTransformOrigin="0.5,0.5"><Image.RenderTransform><ScaleTransformx:Name="AnimatedImageScaleTranform"ScaleX="1"ScaleY="1"/></Image.RenderTransform></Image></Border><!-- This StackPanel contains buttons that control the storyboard. --><StackPanelOrientation="Horizontal"Margin="0,30,0,0"><ButtonName="BeginButton">Start Transition</Button><ButtonName="SkipToFillButton">Skip To Fill</Button><ButtonName="StopButton">Stop</Button><StackPanel.Triggers><!-- Begin the storyboard that shrinks the image. After the storyboard completes, --><EventTriggerRoutedEvent="Button.Click"SourceName="BeginButton"><BeginStoryboardName="ZoomOutBeginStoryboard"><Storyboardx:Name="ZoomOutStoryboard"Completed="zoomOutStoryboardCompleted"FillBehavior="Stop"><DoubleAnimationStoryboard.TargetName="AnimatedImageScaleTranform"Storyboard.TargetProperty="ScaleX"Duration="0:0:5"To="0"FillBehavior="Stop"/><DoubleAnimationStoryboard.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. --><EventTriggerRoutedEvent="Button.Click"SourceName="SkipToFillButton"><SkipStoryboardToFillBeginStoryboardName="ZoomOutBeginStoryboard"/></EventTrigger><!-- Stops the storyboard. This action does not trigger the completed event. --><EventTriggerRoutedEvent="Button.Click"SourceName="StopButton"><StopStoryboardBeginStoryboardName="ZoomOutBeginStoryboard"/></EventTrigger></StackPanel.Triggers></StackPanel></StackPanel></Page>
// TimelineCompletedExample.xaml.cs// Handles the ZoomOutStoryboard's Completed event.// See the TimelienCompletedExample.xaml file// for the markup that creates the images and storyboards.using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; namespace SDKSample { publicpartialclass TimelineCompletedExample : Page { private Storyboard zoomInStoryboard; private ImageSource currentImageSource; private ImageSource nextImageSource; public TimelineCompletedExample() { InitializeComponent(); } privatevoid exampleLoaded(object sender, RoutedEventArgs e) { // Cache the zoom-out storyboard resource. zoomInStoryboard = (Storyboard) this.Resources["ZoomInStoryboardResource"]; // Cache the ImageSource resources. currentImageSource = (ImageSource) this.Resources["RectangleDrawingImage"]; nextImageSource = (ImageSource) this.Resources["CircleDrawingImage"]; // Display the current image source. AnimatedImage.Source = currentImageSource; } // Handles the zoom-out storyboard's completed event. privatevoid zoomOutStoryboardCompleted(object sender, EventArgs e) { AnimatedImage.Source = nextImageSource; nextImageSource = currentImageSource; currentImageSource = AnimatedImage.Source; zoomInStoryboard.Begin(AnimatedImage, HandoffBehavior.SnapshotAndReplace); } } }
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.