ISystemBackdropController.SetTarget Method

Definition

Overloads

SetTarget(WindowId, CompositionTarget)

Connects a system backdrop controller to an HWND or AppWindow with the specified WindowId.

SetTarget(CoreWindow, CompositionTarget)

Connects a system backdrop controller to the specified CoreWindow.

SetTarget(WindowId, CompositionTarget)

Connects a system backdrop controller to an HWND or AppWindow with the specified WindowId.

public:
 bool SetTarget(WindowId windowId, CompositionTarget ^ desktopWindowTarget);
/// [Windows.Foundation.Metadata.DefaultOverload]
/// [Windows.Foundation.Metadata.Overload("SetTargetWithWindowId")]
bool SetTarget(WindowId const& windowId, CompositionTarget const& desktopWindowTarget);
[Windows.Foundation.Metadata.DefaultOverload]
[Windows.Foundation.Metadata.Overload("SetTargetWithWindowId")]
public bool SetTarget(WindowId windowId, CompositionTarget desktopWindowTarget);
function setTarget(windowId, desktopWindowTarget)
Public Function SetTarget (windowId As WindowId, desktopWindowTarget As CompositionTarget) As Boolean

Parameters

windowId
WindowId

The identifier for the HWND or AppWindow to connect to.

desktopWindowTarget
CompositionTarget

The composition target to connect to.

Returns

Boolean

bool

true if the controller was able to set up the material as a system backdrop; otherwise, false.

Attributes

Examples

This example shows how to draw the Mica material in a Win32 app window using C++/WinRT.

bool SetupBackdrop(winrt::Microsoft::UI::WindowId windowId, winrt::Windows::UI::Composition::CompositionTarget compositionTarget)
{
    winrt::Microsoft::UI::Composition::SystemBackdrops::MicaController micaController = winrt::MicaController();
    return micaController.SetTarget(windowId, compositionTarget);
}

Remarks

Use this method to connect the ISystemBackdropController to a Win32 HWND or an AppWindow.

This method must be called on a thread with a DispatcherQueue.

When used in a Win32 application, desktop acrylic requires the DWM window attribute DWMWA_USE_HOSTBACKDROPBRUSH to be set on the top level hWnd in order to work.

See also

Applies to

SetTarget(CoreWindow, CompositionTarget)

Connects a system backdrop controller to the specified CoreWindow.

public:
 bool SetTarget(CoreWindow ^ coreWindow, CompositionTarget ^ compositionTarget);
/// [Windows.Foundation.Metadata.Overload("SetTargetWithCoreWindow")]
bool SetTarget(CoreWindow const& coreWindow, CompositionTarget const& compositionTarget);
[Windows.Foundation.Metadata.Overload("SetTargetWithCoreWindow")]
public bool SetTarget(CoreWindow coreWindow, CompositionTarget compositionTarget);
function setTarget(coreWindow, compositionTarget)
Public Function SetTarget (coreWindow As CoreWindow, compositionTarget As CompositionTarget) As Boolean

Parameters

coreWindow
CoreWindow

The CoreWindow to connect to.

compositionTarget
CompositionTarget

The composition target to connect to.

Returns

Boolean

bool

true if the controller was able to set up the material as a system backdrop; otherwise, false.

Attributes

Remarks

Use this method to connect the ISystemBackdropController to a CoreWindow.

This method must be called on a thread with a DispatcherQueue.

Applies to