Share via


MicaController.SetTarget Method

Definition

Overloads

SetTarget(WindowId, CompositionTarget)

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

SetTarget(CoreWindow, CompositionTarget)

Connects this system backdrop controller to the specified CoreWindow.

SetTarget(WindowId, CompositionTarget)

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

public:
 virtual bool SetTarget(WindowId windowId, CompositionTarget ^ desktopWindowTarget) = SetTarget;
/// [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.

Implements

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 MicaController to a Win32 HWND or an AppWindow.

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

See also

Applies to

SetTarget(CoreWindow, CompositionTarget)

Connects this system backdrop controller to the specified CoreWindow.

public:
 virtual bool SetTarget(CoreWindow ^ coreWindow, CompositionTarget ^ compositionTarget) = SetTarget;
/// [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.

Implements

Attributes

Remarks

Use this method to connect the MicaController to a CoreWindow.

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

Applies to