44using Microsoft . UI . Composition ;
55using Microsoft . UI . Composition . SystemBackdrops ;
66using Microsoft . UI . Xaml ;
7- using Microsoft . UI . Xaml . Controls ;
87using Microsoft . UI . Xaml . Media ;
98using System ;
109using Windows . UI ;
@@ -18,7 +17,6 @@ public sealed partial class MainWindow
1817 private double _lastOpacity = 100 ;
1918 private ISystemBackdropControllerWithTargets ? _controller ;
2019 private ICompositionSupportsSystemBackdrop ? _target ;
21-
2220 private static readonly SystemBackdropConfiguration _config = new ( )
2321 {
2422 IsInputActive = true
@@ -35,7 +33,7 @@ public static void UpdateTheme(ElementTheme selectedTheme)
3533 {
3634 _ = Microsoft . UI . Windowing . AppWindow . GetFromWindowId (
3735 Microsoft . UI . Win32Interop . GetWindowIdFromWindow (
38- WinRT . Interop . WindowNative . GetWindowHandle ( window )
36+ WinRT . Interop . WindowNative . GetWindowHandle ( window )
3937 )
4038 ) ;
4139
@@ -107,7 +105,8 @@ public void ApplyBackdrop(string backdropType, bool compulsory)
107105 backdropType = "Acrylic" ;
108106
109107 RootGrid . Background = new SolidColorBrush ( Colors . Transparent ) ;
110- _target = this . As < ICompositionSupportsSystemBackdrop > ( ) ;
108+
109+ _target = ( ICompositionSupportsSystemBackdrop ) ( object ) this ;
111110
112111 switch ( backdropType )
113112 {
@@ -121,7 +120,7 @@ public void ApplyBackdrop(string backdropType, bool compulsory)
121120 case "MicaAlt" :
122121 _controller = new MicaController ( )
123122 {
124- LuminosityOpacity = ( float ) ( opacity / 100 * 0.95 ) ,
123+ LuminosityOpacity = ( float ) ( opacity / 100 * 0.85 ) ,
125124 TintColor = GetBackgroundColor ( ) ,
126125 Kind = MicaKind . BaseAlt
127126 } ;
@@ -232,8 +231,7 @@ private void UpdateBackgroundImage()
232231
233232 public void UpdateBackgroundImageOpacity ( double opacity )
234233 {
235- if ( _backgroundImageBrush != null )
236- _backgroundImageBrush . Opacity = opacity ;
234+ _backgroundImageBrush ? . Opacity = opacity ;
237235 }
238236
239237 private void OnThemeChanged ( FrameworkElement sender , object args )
@@ -243,4 +241,4 @@ private void OnThemeChanged(FrameworkElement sender, object args)
243241 ApplyBackdrop ( backdrop , true ) ;
244242 }
245243 }
246- }
244+ }
0 commit comments