@@ -418,11 +418,6 @@ public bool ChangeTheme(string theme = null)
418418 if ( string . IsNullOrEmpty ( path ) )
419419 throw new DirectoryNotFoundException ( $ "Theme path can't be found <{ path } >") ;
420420
421- // Retrieve theme resource – always use the resource with font settings applied.
422- var resourceDict = GetResourceDictionary ( theme ) ;
423-
424- UpdateResourceDictionary ( resourceDict ) ;
425-
426421 _settings . Theme = theme ;
427422
428423 // Always allow re-loading default theme, in case of failure of switching to a new theme from default theme
@@ -432,7 +427,8 @@ public bool ChangeTheme(string theme = null)
432427 }
433428
434429 // Check if blur is enabled
435- BlurEnabled = Win32Helper . IsBackdropSupported ( ) && IsThemeBlurEnabled ( resourceDict ) ;
430+ var dict = GetThemeResourceDictionary ( theme ) ;
431+ BlurEnabled = Win32Helper . IsBackdropSupported ( ) && IsThemeBlurEnabled ( dict ) ;
436432
437433 // Apply blur and drop shadow effect so that we do not need to call it again
438434 _ = RefreshFrameAsync ( ) ;
@@ -706,30 +702,27 @@ private void SetBlurForWindow(string theme, BackdropTypes backdropType)
706702
707703 private void AutoDropShadow ( bool useDropShadowEffect )
708704 {
709- SetWindowCornerPreference ( "Default" ) ;
710- RemoveDropShadowEffectFromCurrentTheme ( ) ;
711705 if ( useDropShadowEffect )
712706 {
713707 if ( BlurEnabled && Win32Helper . IsBackdropSupported ( ) )
714708 {
709+ // For themes with blur enabled, the window border is rendered by the system,
710+ // so we set corner preference to round and remove drop shadow effect to avoid rendering issues.
715711 SetWindowCornerPreference ( "Round" ) ;
712+ RemoveDropShadowEffectFromCurrentTheme ( ) ;
716713 }
717714 else
718715 {
716+ // For themes without blur, we set corner preference to default and add drop shadow effect.
719717 SetWindowCornerPreference ( "Default" ) ;
720718 AddDropShadowEffectToCurrentTheme ( ) ;
721719 }
722720 }
723721 else
724722 {
725- if ( BlurEnabled && Win32Helper . IsBackdropSupported ( ) )
726- {
727- SetWindowCornerPreference ( "Default" ) ;
728- }
729- else
730- {
731- RemoveDropShadowEffectFromCurrentTheme ( ) ;
732- }
723+ // When drop shadow effect is disabled, we set corner preference to default and remove drop shadow effect.
724+ SetWindowCornerPreference ( "Default" ) ;
725+ RemoveDropShadowEffectFromCurrentTheme ( ) ;
733726 }
734727 }
735728
0 commit comments