diff --git a/WinUIGallery/ControlPages/SystemBackdropsPage.xaml b/WinUIGallery/ControlPages/SystemBackdropsPage.xaml index 198954ca3..324888ae7 100644 --- a/WinUIGallery/ControlPages/SystemBackdropsPage.xaml +++ b/WinUIGallery/ControlPages/SystemBackdropsPage.xaml @@ -50,6 +50,11 @@ + + + + diff --git a/WinUIGallery/ControlPages/SystemBackdropsPage.xaml.cs b/WinUIGallery/ControlPages/SystemBackdropsPage.xaml.cs index 20b16eacf..c62db42d3 100644 --- a/WinUIGallery/ControlPages/SystemBackdropsPage.xaml.cs +++ b/WinUIGallery/ControlPages/SystemBackdropsPage.xaml.cs @@ -40,7 +40,14 @@ private void createCustomMicaWindow_Click(object sender, RoutedEventArgs e) private void createBuiltInAcrylicWindow_Click(object sender, RoutedEventArgs e) { var newWindow = new AppUIBasics.SamplePages.SampleSystemBackdropsWindow(); - newWindow.SetBackdrop(AppUIBasics.SamplePages.SampleSystemBackdropsWindow.BackdropType.DesktopAcrylic); + newWindow.SetBackdrop(AppUIBasics.SamplePages.SampleSystemBackdropsWindow.BackdropType.DesktopAcrylicBase); + newWindow.Activate(); + } + + private void createCustomDesktopAcrylicWindow_Click(object sender, RoutedEventArgs e) + { + var newWindow = new AppUIBasics.SamplePages.SampleSystemBackdropsWindow(); + newWindow.SetBackdrop(AppUIBasics.SamplePages.SampleSystemBackdropsWindow.BackdropType.DesktopAcrylicBase); newWindow.Activate(); } } diff --git a/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample1.txt b/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample1.txt index 357e01e7c..5606bd3b5 100644 --- a/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample1.txt +++ b/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample1.txt @@ -5,7 +5,7 @@ WindowsSystemDispatcherQueueHelper m_wsdqHelper; // See separate sample below fo Microsoft.UI.Composition.SystemBackdrops.MicaController m_micaController; Microsoft.UI.Composition.SystemBackdrops.SystemBackdropConfiguration m_configurationSource; -bool TrySetMicaBackdrop() +bool TrySetMicaBackdrop(bool useMicaAlt) { if (Microsoft.UI.Composition.SystemBackdrops.MicaController.IsSupported()) { @@ -24,6 +24,8 @@ bool TrySetMicaBackdrop() m_micaController = new Microsoft.UI.Composition.SystemBackdrops.MicaController(); + m_micaController.Kind = useMicaAlt ? Microsoft.UI.Composition.SystemBackdrops.MicaKind.BaseAlt : Microsoft.UI.Composition.SystemBackdrops.MicaKind.Base; + // Enable the system backdrop. // Note: Be sure to have "using WinRT;" to support the Window.As<...>() call. m_micaController.AddSystemBackdropTarget(this.As()); diff --git a/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample2.txt b/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample2.txt index 0a14ad08a..f47c55ac2 100644 --- a/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample2.txt +++ b/WinUIGallery/ControlPagesSampleCode/SystemBackdrops/SystemBackdropsSample2.txt @@ -5,7 +5,7 @@ WindowsSystemDispatcherQueueHelper m_wsdqHelper; // See separate sample below fo Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicController m_acrylicController; Microsoft.UI.Composition.SystemBackdrops.SystemBackdropConfiguration m_configurationSource; -bool TrySetAcrylicBackdrop() +bool TrySetAcrylicBackdrop(bool useAcrylicThin) { if (Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicController.IsSupported()) { @@ -24,6 +24,8 @@ bool TrySetAcrylicBackdrop() m_acrylicController = new Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicController(); + m_acrylicController.Kind = useAcrylicThin ? Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicKind.Thin : Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicKind.Base; + // Enable the system backdrop. // Note: Be sure to have "using WinRT;" to support the Window.As<...>() call. m_acrylicController.AddSystemBackdropTarget(this.As()); diff --git a/WinUIGallery/SamplePages/SampleSystemBackdropsWindow.xaml.cs b/WinUIGallery/SamplePages/SampleSystemBackdropsWindow.xaml.cs index 487c4049c..66148b84f 100644 --- a/WinUIGallery/SamplePages/SampleSystemBackdropsWindow.xaml.cs +++ b/WinUIGallery/SamplePages/SampleSystemBackdropsWindow.xaml.cs @@ -64,7 +64,8 @@ public enum BackdropType { Mica, MicaAlt, - DesktopAcrylic, + DesktopAcrylicBase, + DesktopAcrylicThin, DefaultColor, } @@ -112,7 +113,7 @@ public void SetBackdrop(BackdropType type) else { // Mica isn't supported. Try Acrylic. - type = BackdropType.DesktopAcrylic; + type = BackdropType.DesktopAcrylicBase; tbChangeStatus.Text += " Mica isn't supported. Trying Acrylic."; } } @@ -126,23 +127,37 @@ public void SetBackdrop(BackdropType type) else { // MicaAlt isn't supported. Try Acrylic. - type = BackdropType.DesktopAcrylic; + type = BackdropType.DesktopAcrylicBase; tbChangeStatus.Text += " MicaAlt isn't supported. Trying Acrylic."; } } - if (type == BackdropType.DesktopAcrylic) + if (type == BackdropType.DesktopAcrylicBase) { - if (TrySetAcrylicBackdrop()) + if (TrySetAcrylicBackdrop(false)) { - tbCurrentBackdrop.Text = "Custom Acrylic"; + tbCurrentBackdrop.Text = "Custom Acrylic (Base)"; m_currentBackdrop = type; } else { // Acrylic isn't supported, so take the next option, which is DefaultColor, which is already set. - tbChangeStatus.Text += " Acrylic isn't supported. Switching to default color."; + tbChangeStatus.Text += " Acrylic Base isn't supported. Switching to default color."; } } + if (type == BackdropType.DesktopAcrylicThin) + { + if (TrySetAcrylicBackdrop(true)) + { + tbCurrentBackdrop.Text = "Custom Acrylic (Thin)"; + m_currentBackdrop = type; + } + else + { + // Acrylic isn't supported, so take the next option, which is DefaultColor, which is already set. + tbChangeStatus.Text += " Acrylic Thin isn't supported. Switching to default color."; + } + } + // announce visual change to automation UIHelper.AnnounceActionForAccessibility(btnChangeBackdrop, $"Background changed to {tbCurrentBackdrop.Text}", "BackgroundChangedNotificationActivityId"); } @@ -175,7 +190,7 @@ bool TrySetMicaBackdrop(bool useMicaAlt) return false; // Mica is not supported on this system. } - bool TrySetAcrylicBackdrop() + bool TrySetAcrylicBackdrop(bool useAcrylicThin) { if (Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicController.IsSupported()) { @@ -191,6 +206,8 @@ bool TrySetAcrylicBackdrop() m_acrylicController = new Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicController(); + m_acrylicController.Kind = useAcrylicThin ? Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicKind.Thin : Microsoft.UI.Composition.SystemBackdrops.DesktopAcrylicKind.Base; + // Enable the system backdrop. // Note: Be sure to have "using WinRT;" to support the Window.As<...>() call. m_acrylicController.AddSystemBackdropTarget(this.As()); @@ -248,8 +265,9 @@ void ChangeBackdropButton_Click(object sender, RoutedEventArgs e) switch (m_currentBackdrop) { case BackdropType.Mica: newType = BackdropType.MicaAlt; break; - case BackdropType.MicaAlt: newType = BackdropType.DesktopAcrylic; break; - case BackdropType.DesktopAcrylic: newType = BackdropType.DefaultColor; break; + case BackdropType.MicaAlt: newType = BackdropType.DesktopAcrylicBase; break; + case BackdropType.DesktopAcrylicBase: newType = BackdropType.DesktopAcrylicThin; break; + case BackdropType.DesktopAcrylicThin: newType = BackdropType.DefaultColor; break; default: case BackdropType.DefaultColor: newType = BackdropType.Mica; break; }