From 75cc286ca2a396314edc177ac8f89a9a2611b179 Mon Sep 17 00:00:00 2001 From: Nuklon Date: Thu, 7 Aug 2025 16:28:04 +0200 Subject: [PATCH 1/2] Update FluentWindow.cs --- .../Controls/FluentWindow/FluentWindow.cs | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs b/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs index bccafdb30..01c766519 100644 --- a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs +++ b/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs @@ -103,7 +103,7 @@ static FluentWindow() protected override void OnSourceInitialized(EventArgs e) { OnCornerPreferenceChanged(default, WindowCornerPreference); - OnExtendsContentIntoTitleBarChanged(default, ExtendsContentIntoTitleBar); + OnExtendsContentIntoTitleBarChanged(false, ExtendsContentIntoTitleBar); OnBackdropTypeChanged(default, WindowBackdropType); base.OnSourceInitialized(e); @@ -182,10 +182,11 @@ protected virtual void OnBackdropTypeChanged(WindowBackdropType oldValue, Window return; } + SetWindowChrome(); + if (newValue == WindowBackdropType.None) { _ = WindowBackdrop.RemoveBackdrop(this); - return; } @@ -233,20 +234,23 @@ protected virtual void OnExtendsContentIntoTitleBarChanged(bool oldValue, bool n // AllowsTransparency = true; SetCurrentValue(WindowStyleProperty, WindowStyle.SingleBorderWindow); - WindowChrome.SetWindowChrome( - this, - new WindowChrome - { - CaptionHeight = 0, - CornerRadius = default, - GlassFrameThickness = new Thickness(-1), - ResizeBorderThickness = ResizeMode == ResizeMode.NoResize ? default : new Thickness(4), - UseAeroCaptionButtons = false, - } - ); - // WindowStyleProperty.OverrideMetadata(typeof(FluentWindow), new FrameworkPropertyMetadata(WindowStyle.SingleBorderWindow)); // AllowsTransparencyProperty.OverrideMetadata(typeof(FluentWindow), new FrameworkPropertyMetadata(false)); _ = UnsafeNativeMethods.RemoveWindowTitlebarContents(this); } + + private void SetWindowChrome() + { + WindowChrome.SetWindowChrome( + this, + new WindowChrome + { + CaptionHeight = 0, + CornerRadius = default, + GlassFrameThickness = WindowBackdropType == WindowBackdropType.None ? new Thickness(1) : new Thickness(-1), + ResizeBorderThickness = ResizeMode == ResizeMode.NoResize ? default : new Thickness(4), + UseAeroCaptionButtons = false, + } + ); + } } From ec19b84e2c22cf7da10fa72341e47b55777f16cf Mon Sep 17 00:00:00 2001 From: Nuklon Date: Fri, 8 Aug 2025 13:49:43 +0200 Subject: [PATCH 2/2] Update FluentWindow.cs --- src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs b/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs index 01c766519..2c7441484 100644 --- a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs +++ b/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs @@ -239,7 +239,10 @@ protected virtual void OnExtendsContentIntoTitleBarChanged(bool oldValue, bool n _ = UnsafeNativeMethods.RemoveWindowTitlebarContents(this); } - private void SetWindowChrome() + /// + /// This virtual method is called when is changed. + /// + protected virtual void SetWindowChrome() { WindowChrome.SetWindowChrome( this, @@ -247,7 +250,7 @@ private void SetWindowChrome() { CaptionHeight = 0, CornerRadius = default, - GlassFrameThickness = WindowBackdropType == WindowBackdropType.None ? new Thickness(1) : new Thickness(-1), + GlassFrameThickness = WindowBackdropType == WindowBackdropType.None ? new Thickness(0.00001) : new Thickness(-1), // 0.00001 so there's no glass frame drawn around the window, but the border is still drawn. ResizeBorderThickness = ResizeMode == ResizeMode.NoResize ? default : new Thickness(4), UseAeroCaptionButtons = false, }