@@ -16,6 +16,8 @@ internal sealed class AppSystemBackdrop : SystemBackdrop
1616 private XamlRoot root ;
1717 private SystemBackdropTheme ? prevTheme = null ;
1818
19+ public SystemBackdropConfiguration SystemBackdropConfiguration { get ; set ; }
20+
1921 public AppSystemBackdrop ( bool isSecondaryWindow = false )
2022 {
2123 this . isSecondaryWindow = isSecondaryWindow ;
@@ -32,21 +34,21 @@ protected override void OnTargetConnected(ICompositionSupportsSystemBackdrop con
3234 base . OnTargetConnected ( connectedTarget , xamlRoot ) ;
3335 this . target = connectedTarget ;
3436 this . root = xamlRoot ;
35- var configuration = GetDefaultSystemBackdropConfiguration ( connectedTarget , xamlRoot ) ;
36- controller = GetSystemBackdropController ( userSettingsService . AppearanceSettingsService . AppThemeBackdropMaterial , configuration . Theme ) ;
37- controller ? . SetSystemBackdropConfiguration ( configuration ) ;
37+ SystemBackdropConfiguration = GetDefaultSystemBackdropConfiguration ( connectedTarget , xamlRoot ) ;
38+ controller = GetSystemBackdropController ( userSettingsService . AppearanceSettingsService . AppThemeBackdropMaterial , SystemBackdropConfiguration . Theme ) ;
39+ controller ? . SetSystemBackdropConfiguration ( SystemBackdropConfiguration ) ;
3840 controller ? . AddSystemBackdropTarget ( connectedTarget ) ;
3941 }
4042
4143 protected override void OnDefaultSystemBackdropConfigurationChanged ( ICompositionSupportsSystemBackdrop target , XamlRoot xamlRoot )
4244 {
4345 base . OnDefaultSystemBackdropConfigurationChanged ( target , xamlRoot ) ;
44- var configuration = GetDefaultSystemBackdropConfiguration ( target , xamlRoot ) ;
45- if ( controller is not DesktopAcrylicController acrylicController || acrylicController . Kind != DesktopAcrylicKind . Thin || configuration . Theme == prevTheme )
46+ SystemBackdropConfiguration = GetDefaultSystemBackdropConfiguration ( target , xamlRoot ) ;
47+ if ( controller is not DesktopAcrylicController acrylicController || acrylicController . Kind != DesktopAcrylicKind . Thin || SystemBackdropConfiguration . Theme == prevTheme )
4648 return ;
4749
48- prevTheme = configuration . Theme ;
49- SetThinAcrylicBackdropProperties ( acrylicController , configuration . Theme ) ;
50+ prevTheme = SystemBackdropConfiguration . Theme ;
51+ SetThinAcrylicBackdropProperties ( acrylicController , SystemBackdropConfiguration . Theme ) ;
5052 }
5153
5254 protected override void OnTargetDisconnected ( ICompositionSupportsSystemBackdrop disconnectedTarget )
@@ -79,9 +81,9 @@ private void OnSettingChanged(object? sender, SettingChangedEventArgs e)
7981 case nameof ( IAppearanceSettingsService . AppThemeBackdropMaterial ) :
8082 controller ? . RemoveAllSystemBackdropTargets ( ) ;
8183 controller ? . Dispose ( ) ;
82- var configuration = GetDefaultSystemBackdropConfiguration ( target , root ) ;
83- var newController = GetSystemBackdropController ( ( BackdropMaterialType ) e . NewValue ! , configuration . Theme ) ;
84- newController ? . SetSystemBackdropConfiguration ( configuration ) ;
84+ SystemBackdropConfiguration = GetDefaultSystemBackdropConfiguration ( target , root ) ;
85+ var newController = GetSystemBackdropController ( ( BackdropMaterialType ) e . NewValue ! , SystemBackdropConfiguration . Theme ) ;
86+ newController ? . SetSystemBackdropConfiguration ( SystemBackdropConfiguration ) ;
8587 newController ? . AddSystemBackdropTarget ( target ) ;
8688 controller = newController ;
8789 break ;
0 commit comments