Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -182,10 +182,11 @@ protected virtual void OnBackdropTypeChanged(WindowBackdropType oldValue, Window
return;
}

SetWindowChrome();

if (newValue == WindowBackdropType.None)
{
_ = WindowBackdrop.RemoveBackdrop(this);

return;
}

Expand Down Expand Up @@ -233,20 +234,26 @@ 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);
}

/// <summary>
/// This virtual method is called when <see cref="WindowBackdropType"/> is changed.
/// </summary>
protected virtual void SetWindowChrome()
{
WindowChrome.SetWindowChrome(
this,
new WindowChrome
{
CaptionHeight = 0,
CornerRadius = default,
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,
}
);
}
}