-
Notifications
You must be signed in to change notification settings - Fork 804
Open
Labels
Description
Describe the bug
if the application window is maximized, the main window X andY values results in -11, -11 when the Window_Destroying(). For a non-maximized window, values are correct.
public partial class App : Application
{
private void M_window_Closed(object sender, WindowEventArgs args)
{
var window = sender as Window;
// Get HWND
var hwnd = WindowNative.GetWindowHandle(window);
// Get WindowId
var windowId = Win32Interop.GetWindowIdFromWindow(hwnd);
// Get AppWindow
var appWindow = AppWindow.GetFromWindowId(windowId);
// Get position and size
PointInt32 position = appWindow.Position;
SizeInt32 size = appWindow.Size;
int x = position.X;
int y = position.Y;
int width = size.Width;
int height = size.Height;
Debug.WriteLine($"Window X:{x}, Y:{y}, Width:{width}, Height:{height}");
}
}
Steps to reproduce the bug
- Run the attached sample.
- Maximize application window and close window.
- Observe the output results in X = -11, Y = -11, Width = 1942 and Height = 1030.
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.7.1: 1.7.250401001
Windows version
Windows 11 (23H2): Build 22631
Additional context
No response
Reactions are currently unavailable