From 4954228f149af932993831debc4199255fbed584 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 25 May 2023 22:56:06 +0200 Subject: [PATCH] Fix display of unsupported transparency levels. Only make the window brush transparent when we requested a transparent window and were given one, otherwise we display a transparent brush for e.g. `None` because `None` is not available when using composition. --- samples/ControlCatalog/MainView.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs index 5e33952c68..801844a43c 100644 --- a/samples/ControlCatalog/MainView.xaml.cs +++ b/samples/ControlCatalog/MainView.xaml.cs @@ -85,7 +85,8 @@ namespace ControlCatalog var topLevel = (TopLevel)this.GetVisualRoot()!; topLevel.TransparencyLevelHint = new[] { selected }; - if (selected != WindowTransparencyLevel.None) + if (topLevel.ActualTransparencyLevel != WindowTransparencyLevel.None && + topLevel.ActualTransparencyLevel == selected) { var transparentBrush = new ImmutableSolidColorBrush(Colors.White, 0); var semiTransparentBrush = new ImmutableSolidColorBrush(Colors.Gray, 0.2);