Share via


CompositionTarget.GetCompositorForCurrentThread Method

Definition

Retrieves the Compositor object for this thread.

public:
 static Compositor ^ GetCompositorForCurrentThread();
 static Compositor GetCompositorForCurrentThread();
public static Compositor GetCompositorForCurrentThread();
function getCompositorForCurrentThread()
Public Shared Function GetCompositorForCurrentThread () As Compositor

Returns

The Compositor object for this thread.

Remarks

In XAML apps, we recommend that you call ElementCompositionPreview.GetElementVisual(UIElement) to get a Composition Visual, and get the Compositor from the visual's inherited Compositor property. In cases where you don't have access to a UIElement (for example, if you create a CompositionBrush in a class library), you can call CompositionTarget.GetCompositorForCurrentThread to get the Compositor instead.

Applies to