diff --git a/Aerochat/Controls/BasicTitlebar.cs b/Aerochat/Controls/BasicTitlebar.cs index e9a4252f..cbe3db51 100644 --- a/Aerochat/Controls/BasicTitlebar.cs +++ b/Aerochat/Controls/BasicTitlebar.cs @@ -152,6 +152,33 @@ protected override void OnInitialized(EventArgs e) if (Window != null) { Window.SourceInitialized += Window_SourceInitialized; + Window.StateChanged += Window_StateChanged; + } + } + + private void Window_StateChanged(object? sender, EventArgs e) + { + if (IsDwmEnabled) return; + if (Window.WindowState == WindowState.Maximized) + { + Titlebar.Visibility = Visibility.Collapsed; + WindowChrome.SetWindowChrome(Window, null); + FirstBorder.BorderThickness = new Thickness(0); + SecondBorder.BorderThickness = new Thickness(0); + // set the grid's first row to 0 + Container.RowDefinitions[0].Height = new GridLength(0); + } + else + { + Titlebar.Visibility = Visibility.Visible; + WindowChrome chrome = new WindowChrome(); + chrome.CaptionHeight = 28; + chrome.CornerRadius = new CornerRadius(6, 6, 0, 0); + chrome.GlassFrameThickness = new Thickness(0); + WindowChrome.SetWindowChrome(Window, chrome); + FirstBorder.BorderThickness = new Thickness(1); + SecondBorder.BorderThickness = new Thickness(1); + Container.RowDefinitions[0].Height = new GridLength(28); } } diff --git a/Aerochat/Controls/NoDwmTitlebar.xaml b/Aerochat/Controls/NoDwmTitlebar.xaml index f4a2f481..83c9dde7 100644 --- a/Aerochat/Controls/NoDwmTitlebar.xaml +++ b/Aerochat/Controls/NoDwmTitlebar.xaml @@ -15,7 +15,9 @@ - +