diff --git a/src/Wpf.Ui/Controls/ClientAreaBorder/ClientAreaBorder.cs b/src/Wpf.Ui/Controls/ClientAreaBorder/ClientAreaBorder.cs index 58f50bc1b..c7c0cc516 100644 --- a/src/Wpf.Ui/Controls/ClientAreaBorder/ClientAreaBorder.cs +++ b/src/Wpf.Ui/Controls/ClientAreaBorder/ClientAreaBorder.cs @@ -146,6 +146,9 @@ protected override void OnVisualParentChanged(DependencyObject oldParent) { newWindow.StateChanged -= OnWindowStateChanged; // Unsafe newWindow.StateChanged += OnWindowStateChanged; + Thickness padding = + newWindow.WindowState == WindowState.Maximized ? WindowChromeNonClientFrameThickness : default; + SetCurrentValue(PaddingProperty, padding); newWindow.Closing += OnWindowClosing; } diff --git a/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs b/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs index 471ba3bfc..58d4eb7d6 100644 --- a/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs +++ b/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs @@ -447,6 +447,11 @@ protected virtual void OnLoaded(object sender, RoutedEventArgs e) _currentWindow = System.Windows.Window.GetWindow(this) ?? throw new InvalidOperationException("Window is null"); + if (_currentWindow.WindowState == WindowState.Maximized) + { + SetCurrentValue(IsMaximizedProperty, true); + _currentWindow.SetCurrentValue(Window.WindowStateProperty, WindowState.Maximized); + } _currentWindow.StateChanged += OnParentWindowStateChanged; _currentWindow.ContentRendered += OnWindowContentRendered; }