How can I add Acrylic/Mica materials in a MAUI app targetting Windows?

drmaven 21 Reputation points
2022-06-17T06:27:35.773+00:00

With the release of WinUI 3 1.1, I thought I would be able to add acrylic and mica materials to NET MAUI apps that target Windows.

However, I have not found a way to make it so that a cross-platform XAML page can include acrylic material for the windows devices. Does anyone have any pointers on how to achieve this?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,857 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rob Caplan - MSFT 5,412 Reputation points Microsoft Employee
    2022-06-21T04:52:42.407+00:00

    Acrylic and Mica are Windows specific, so you have to set them up in your Windows specific code section rather than in cross-platfrom code.

    Lance McCarthy ported the essential pieces of the WinUI Gallery's SystemBackdrops sample to MAUI and shared files to set up Mica or Acrylic (whichever is available) in a MAUI app in his github repo at https://gist.github.com/LanceMcCarthy/4954ab92ca44c19eb4316d9d683efd50

    This gets the Window's WinUI handle from the OnWindowCreated lifecycle event and then sets Mica/Acrylic on the window in Windows specific code in the MAUI app's Windows folder.

    If you want to target more narrowly than the window (more likely for other WinUI customizations) you can get access to the WinUI PlatformView backing the MAUI control via the control's handler. See Customize .NET MAUI controls with handlers and


0 additional answers

Sort by: Most helpful