Window.Resized event receives incorrect WindowState in some scenarios
Describe the bug
Under certain conditions the Window.Resized event handler receives the incorrect WindowState
In the example there are two SizeGrips on the window. One has the ElementRole Resize, the other not. This to demonstrate that ElementRole is not connected to this.
Correct WindowState received When the windows is maximized / restored using the Maximize/Restore system button the state is updated correctly.
Incorrect WindowState received When the windows is maximized/restored by double click on the title bar. When the window is maximized, then minimized and back maximized again.
When the window is restored and slighty resized the state is read again and is correct.
Work-around When the same code is run through the Dispatcher.UIThread it updates correct.
See attached video: https://github.com/user-attachments/assets/79edb1a7-5d9e-431b-8893-52baa6cca5e2
To Reproduce
See attached sample project. WindowStateInconsistentOnResized.zip
Expected behavior
The WindowState should be reflected correctly.
Avalonia version
12.1.3
OS
Windows
Additional context
Tested on .NET10 Windows 11: 23H2 & 25H2
Source: AvaloniaUI/Avalonia