@@ -16,6 +16,8 @@ internal sealed class AppSystemBackdrop : SystemBackdrop
16
16
private XamlRoot root ;
17
17
private SystemBackdropTheme ? prevTheme = null ;
18
18
19
+ public SystemBackdropConfiguration SystemBackdropConfiguration { get ; set ; }
20
+
19
21
public AppSystemBackdrop ( bool isSecondaryWindow = false )
20
22
{
21
23
this . isSecondaryWindow = isSecondaryWindow ;
@@ -32,21 +34,21 @@ protected override void OnTargetConnected(ICompositionSupportsSystemBackdrop con
32
34
base . OnTargetConnected ( connectedTarget , xamlRoot ) ;
33
35
this . target = connectedTarget ;
34
36
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 ) ;
38
40
controller ? . AddSystemBackdropTarget ( connectedTarget ) ;
39
41
}
40
42
41
43
protected override void OnDefaultSystemBackdropConfigurationChanged ( ICompositionSupportsSystemBackdrop target , XamlRoot xamlRoot )
42
44
{
43
45
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 )
46
48
return ;
47
49
48
- prevTheme = configuration . Theme ;
49
- SetThinAcrylicBackdropProperties ( acrylicController , configuration . Theme ) ;
50
+ prevTheme = SystemBackdropConfiguration . Theme ;
51
+ SetThinAcrylicBackdropProperties ( acrylicController , SystemBackdropConfiguration . Theme ) ;
50
52
}
51
53
52
54
protected override void OnTargetDisconnected ( ICompositionSupportsSystemBackdrop disconnectedTarget )
@@ -79,9 +81,9 @@ private void OnSettingChanged(object? sender, SettingChangedEventArgs e)
79
81
case nameof ( IAppearanceSettingsService . AppThemeBackdropMaterial ) :
80
82
controller ? . RemoveAllSystemBackdropTargets ( ) ;
81
83
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 ) ;
85
87
newController ? . AddSystemBackdropTarget ( target ) ;
86
88
controller = newController ;
87
89
break ;
0 commit comments