CompositionScopedBatch
CompositionScopedBatch
CompositionScopedBatch
CompositionScopedBatch
Class
Definition
An explicitly created group of active animations or effects.
public : sealed class CompositionScopedBatch : CompositionObject, ICompositionScopedBatchpublic sealed class CompositionScopedBatch : CompositionObject, ICompositionScopedBatchPublic NotInheritable Class CompositionScopedBatch Inherits CompositionObject Implements ICompositionScopedBatch// This API is not available in Javascript.
- Inheritance
-
CompositionScopedBatchCompositionScopedBatchCompositionScopedBatchCompositionScopedBatch
- Attributes
| Device family |
Windows 10 (introduced v10.0.10586.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v2)
|
Inherited Members
Inherited methods
Inherited properties
Examples
Scoped Batch
// The Green Square's completion events for the Offset and Opacity animations are aggregated
// The Rotation animation completion event is not aggregated
// When the aggregated events are completed OnBatchCompleted method is executed
public void BatchAnimations()
{
// Create a Scoped batch to capture animation completion events
_batch = _compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
// Executing the Offset animation and aggregating completion event
ApplyOffsetAnimation(_greenSquare);
// Suspending to exclude the following Rotation animation from the batch
_batch.Suspend();
// Executing the Rotation animation
ApplyRotationAnimation(_greenSquare);
// Resuming the batch to collect additional animations
_batch.Resume();
// Executing the Opacity animation and aggregating completion event
ApplyOpacityAnimation(_greenSquare);
// Batch is ended and no objects can be added
_batch.End();
// Method triggered when batch completion event fires
_batch.Completed += OnBatchCompleted;
}
Remarks
Represents a group of active animations or effects and triggers a callback when all members of the group have completed. A CompositionScopedBatch is explicitly created and is used to designate specific objects to be included in a single Scoped batch.
A scoped batch is explicitly created using Compositor.CreateScopedBatch and is used to designate specific objects to be included in a single batch. A Scoped batch can be created on any thread and is not tied to the composition thread. Scoped batches will only aggregate objects within the thread it is created.
CompositionScopedBatch may be explicitly paused with Suspend in order to exclude objects from that batch. When a batch is suspended it can be reopened by calling Resume.
A CompositionScopedBatch must be explicitly closed using End. Once it has been closed it cannot be suspended or resumed again.
Multiple CompositionScopedBatch instances can be created and objects can be aggregated in multiple batches at the same time.
See Composition Animations Overview for more information on composition batches.
Properties
IsActive IsActive IsActive IsActive
Indicates whether the CompositionScopedBatch is currently opened for objects to be aggregated.
public : PlatForm::Boolean IsActive { get; }public bool IsActive { get; }Public ReadOnly Property IsActive As bool// This API is not available in Javascript.
- Value
- PlatForm::Boolean bool bool bool
Boolean indicating whether the CompositionScopedBatch is currently opened for objects to be aggregated.
IsEnded IsEnded IsEnded IsEnded
Indicates whether the CompositionScopedBatch has been closed and can no longer accept changes.
public : PlatForm::Boolean IsEnded { get; }public bool IsEnded { get; }Public ReadOnly Property IsEnded As bool// This API is not available in Javascript.
- Value
- PlatForm::Boolean bool bool bool
Boolean indicating whether the CompositionScopedBatch has been closed and can no longer accept changes.
Methods
End() End() End() End()
Closes the CompositionScopedBatch. Once the CompositionScopedBatch has been closed it cannot be suspended or resumed again.
public : void End()public void End()Public Function End() As void// This API is not available in Javascript.
Resume() Resume() Resume() Resume()
Resumes aggregating objects in the CompositionScopedBatch.
public : void Resume()public void Resume()Public Function Resume() As void// This API is not available in Javascript.
Suspend() Suspend() Suspend() Suspend()
Suspends aggregating objects in the CompositionScopedBatch.
public : void Suspend()public void Suspend()Public Function Suspend() As void// This API is not available in Javascript.
Events
Completed Completed Completed Completed
Event triggered once all animations and effects in the CompositionScopedBatch have completed.
public : event TypedEventHandler Completed<object, CompositionBatchCompletedEventArgs>public event TypedEventHandler Completed<object, CompositionBatchCompletedEventArgs>Public Event Completed<object, CompositionBatchCompletedEventArgs>// This API is not available in Javascript.