@@ -674,16 +674,12 @@ private void SetBlurForWindow(string theme, BackdropTypes backdropType)
674674 if ( backdropType == BackdropTypes . Mica || backdropType == BackdropTypes . MicaAlt )
675675 {
676676 windowBorderStyle . Setters . Remove ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property == Control . BackgroundProperty ) ) ;
677- var brush = new SolidColorBrush ( Color . FromArgb ( 1 , 0 , 0 , 0 ) ) ;
678- brush . Freeze ( ) ;
679- windowBorderStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , brush ) ) ;
677+ windowBorderStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , ThemeHelper . GetFreezeSolidColorBrush ( Color . FromArgb ( 1 , 0 , 0 , 0 ) ) ) ) ;
680678 }
681679 else if ( backdropType == BackdropTypes . Acrylic )
682680 {
683681 windowBorderStyle . Setters . Remove ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property == Control . BackgroundProperty ) ) ;
684- var brush = new SolidColorBrush ( Colors . Transparent ) ;
685- brush . Freeze ( ) ;
686- windowBorderStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , brush ) ) ;
682+ windowBorderStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , Brushes . Transparent ) ) ;
687683 }
688684
689685 // For themes with blur enabled, the window border is rendered by the system, so it's treated as a simple rectangle regardless of thickness.
@@ -806,10 +802,8 @@ private void ApplyPreviewBackground(Color? bgColor = null)
806802 }
807803
808804 // Apply background color (remove transparency in color)
809- Color backgroundColor = Color . FromRgb ( bgColor . Value . R , bgColor . Value . G , bgColor . Value . B ) ;
810- var brush = new SolidColorBrush ( backgroundColor ) ;
811- brush . Freeze ( ) ;
812- previewStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , brush ) ) ;
805+ var backgroundColor = Color . FromRgb ( bgColor . Value . R , bgColor . Value . G , bgColor . Value . B ) ;
806+ previewStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , ThemeHelper . GetFreezeSolidColorBrush ( backgroundColor ) ) ) ;
813807
814808 // The blur theme keeps the corner round fixed (applying DWM code to modify it causes rendering issues).
815809 // The non-blur theme retains the previously set WindowBorderStyle.
@@ -923,15 +917,11 @@ private void ColorizeWindow(string theme, BackdropTypes backdropType)
923917 // Only set the background to transparent if the theme supports blur
924918 if ( backdropType == BackdropTypes . Mica || backdropType == BackdropTypes . MicaAlt )
925919 {
926- var backgroundBrush = new SolidColorBrush ( Color . FromArgb ( 1 , 0 , 0 , 0 ) ) ;
927- backgroundBrush . Freeze ( ) ;
928- mainWindow . Background = backgroundBrush ;
920+ mainWindow . Background = ThemeHelper . GetFreezeSolidColorBrush ( Color . FromArgb ( 1 , 0 , 0 , 0 ) ) ;
929921 }
930922 else
931923 {
932- var backgroundBrush = new SolidColorBrush ( selectedBG ) ;
933- backgroundBrush . Freeze ( ) ;
934- mainWindow . Background = backgroundBrush ;
924+ mainWindow . Background = ThemeHelper . GetFreezeSolidColorBrush ( selectedBG ) ;
935925 }
936926 }
937927 }
0 commit comments