CompositionTarget Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the composited display surface for an app. This class provides application-wide rendering events.
public ref class CompositionTarget sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CompositionTarget final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class CompositionTarget
Public NotInheritable Class CompositionTarget
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Remarks
CompositionTarget events are useful for rendering scenarios like:
synchronizing DirectX interop rendering using the Rendering event
measuring frame rendering time using the Rendered event
regenerating custom visual content on screen in response to the SurfaceContentsLost event, for example regenerating a RenderTargetBitmap or DirectX interop content in a SurfaceImageSource
For scenarios that don't involve custom rendering or frame time measurement you probably won't need CompositionTarget and can just rely on the XAML rendering system running and performing all your composition and layout.
Version history
Windows version | SDK version | Value added |
---|---|---|
1803 | 17134 | Rendered |
Events
Rendered |
Occurs immediately after the core rendering process renders a frame. This event lets you determine how long each frame takes to render. |
Rendering |
Occurs when the core rendering process renders a frame. |
SurfaceContentsLost |
Occurs when an underlying major change occurs, such as a DirectX device change. Typically the application must regenerate its surface contents when notified of this event. |