From a57e0848de87684a172d9174b3c5cfb22fb9196f Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 23 Mar 2026 15:20:30 +0500 Subject: [PATCH] We can't have nice things --- src/Avalonia.Controls/Window.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index 47d571e5b7..a467357f1e 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -428,7 +428,6 @@ namespace Avalonia.Controls public WindowState WindowState { get => GetValue(WindowStateProperty); - [Obsolete("Use TrySetWindowState")] set => SetValue(WindowStateProperty, value); } @@ -675,6 +674,10 @@ namespace Avalonia.Controls #pragma warning restore CS0618 // Type or member is obsolete } + /// + /// Attempt to transition the window state to the specified state. The request might be delayed or + /// ignored by the underlying platform + /// public void TrySetWindowState(WindowState state) { PlatformImpl?.WindowState = state; @@ -1441,7 +1444,10 @@ namespace Avalonia.Controls if (_canHandleResized && (ClientSize != clientSize || double.IsNaN(Width) || double.IsNaN(Height))) { var sizeToContent = SizeToContent; - + + // If auto-sizing is enabled, and the resize came from a user resize (or the reason was + // unspecified) then turn off auto-resizing for any window dimension that is not equal + // to the requested size. if (sizeToContent != SizeToContent.Manual && CanResize && reason == WindowResizeReason.Unspecified ||