// 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
// Suspending to exclude the following Rotation animation from the batch
// Executing the Rotation animation
// Resuming the batch to collect additional animations
// Executing the Opacity animation and aggregating completion event
// Batch is ended and no objects can be added
// Method triggered when batch completion event fires
_batch.Completed += OnBatchCompleted;
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.