Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 2.37 KB

isystembackdropcontroller.md

File metadata and controls

36 lines (24 loc) · 2.37 KB
-api-id -api-type
T:Microsoft.UI.Composition.SystemBackdrops.ISystemBackdropController
winrt interface

Microsoft.UI.Composition.SystemBackdrops.ISystemBackdropController

-description

Provides methods to connect a system backdrop controller to a window.

-remarks

A system backdrop is essentially a CompositionBrush that defines a UI material such as Acrylic or Mica. This brush is drawn by the system compositor. A system backdrop controller is an object that encapsulates both the rendering of the system backdrop material as well as the handling of system policy for the given material. Each material has its own controller.

You can draw a material at the back of your content by creating the corresponding ISystemBackdropController and providing your window and CompositionTarget to the controller's SetTarget method. If SetTarget succeeds and returns true, the controller takes care of all material handling, including fallback rendering and all system policies. If SetTarget fails and returns false, it means the controller was unable to set up the desired material as a system backdrop, and no changes have been made to the CompositionTarget.

Materials are drawn using the Windows.UI.Composition APIs, so a CompositionTarget is required on which the material will be drawn at the very back behind the rest of the app content. Any app content that has transparency will show through to the chosen material.

-see-also

-examples

This example shows how to draw the new Windows 11 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);
}