按照 Microsoft 官方的说明,如果我们需要在 UWP 项目中使用 Mica 或 Desktop Acrylic 背景色,需要引入 Microsoft.UI.Xaml (WinUI 2)Nuget 包依赖,而且 WinUI 2 只有 Mica Base,没有 Mica Alt。
然而当我们不想使用 WinUI 2 ,想构建自定义的背景色时,需要引入 Win2D 开源库来完成这一操作。所以在本项目中,我们提供了一种不依赖于 Win2D 的 Mica 和 Desktop Acrylic 背景色实现,使用的 Mica 或 Desktop Acrylic 的 API 规范,默认提供的色彩样式基本与 Windows App SDK 项目保持一致。
According to the official instructions of Microsoft, if we need to use Mica or Desktop Acrylic background color in UWP project, we need to introduce Microsoft.Ui.XAML (WinUI 2) Nuget package dependence. And WinUI 2 only has Mica Base, no Mica Alt.
However, when we do not want to use WinUI 2 and want to build a custom systembackdrop, we need to introduce Win2D open source library to accomplish this operation. Therefore, in this project, we provide a Mica and Desktop Acrylic background color implementation independent of Win2D, using Mica or Desktop Acrylic API specification. The color styles provided by default are basically consistent with the Windows App SDK project.
SystemBackdrop: provides an abstract class against the background and is not available for instantiation
LightFallbackColor: In Light mode gets or sets system conditions that prevent rendering of the solid color to be used when mica material.
DarkFallbackColor: Gets or sets a system condition in dark mode to prevent the solid color to be used when rendering mica material.
IsInputActive: Gets or sets a value indicating whether the system background should treat the current window as having input focus.
ResetProperties: Resets all custom properties to their system defaults and reverts to automatic light/dark theme handling.
DesktopAcrylicKind:Desktop Acrylic 背景色材料类型,两种类型(DesktopAcrylicDefault、DesktopAcrylicBase 和 DesktopAcrylicThin)
DesktopAcrylicKind: DesktopAcrylic background color material type, two types (DesktopAcrylicDefault, DesktopAcrylicBase, and DesktopAcrylicThin)
UseHostBackdropBrush: Determines whether the brush samples content from the application content or from behind the window. True is the content behind the window, False is the content of the application.
IsHostBackdropSupported: Determines whether the current operating system supports brush sample content from behind a window.
云母背景色(Mica Systembackdrop):https://learn.microsoft.com/windows/apps/design/style/mica
亚克力背景色(Acrylic Systembackdrop):https://learn.microsoft.com/windows/apps/design/style/acrylic
Win32 中使用背景色(Win32 use Systembackdrop):https://learn.microsoft.com/windows/apps/desktop/modernize/apply-mica-win32
WinUI 3 中使用背景色(WinUI 3 use Systembackdrop):https://learn.microsoft.com/windows/apps/windows-app-sdk/system-backdrop-controller
API 来源说明(API source description):https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops?view=windows-app-sdk-1.5