The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
Maximizing the window of an app that has had its draggable area dynamically calculated causes the draggable area to not behave as expected. In our experience, the draggable area seems to start starting at the starting point + half of the width, to beyond some point. Additionally, the minimize and maximize buttons remain operable, the close button is not clickable.
Steps to reproduce the bug
Code
Import this method
[DllImport("User32.dll")]
internal static extern int GetDpiForWindow(IntPtr hwnd);
At some point in the app (perhaps on window size change), run this code
var scale = GetDpiForWindow() / 96f;
var rect = new RectInt32((int)(DragStart * scale), 0, (int)((DragEnd - DragStart) * scale), (int)(48 * scale));
AppWindow?.TitleBar?.SetDragRectangles(new[] { rect });
where DragEnd and DragStart are defined as the starting and stopping points on the x-axis that the draggable area should start and stop.
Running
Run the app, and resize the window (or whatever should trigger this). The draggable area at the top of the window should work correctly. Now, maximize the window. The draggable area does not work as expected.
Expected behavior
The draggable area covers the expected, provided area when maximized.
Screenshots
No response
NuGet package version
Windows App SDK 1.5.5: 1.5.240627000
Packaging type
Packaged (MSIX)
Windows version
No response
IDE
Visual Studio 2022
Additional context
The behavior is exhibited in 1.5.5, I was able to reproduce the issue as well in 1.5.4.
Describe the bug
Maximizing the window of an app that has had its draggable area dynamically calculated causes the draggable area to not behave as expected. In our experience, the draggable area seems to start starting at the starting point + half of the width, to beyond some point. Additionally, the minimize and maximize buttons remain operable, the close button is not clickable.
Steps to reproduce the bug
Code
Import this method
Configure the TitleBar
At some point in the app (perhaps on window size change), run this code
where
DragEnd
andDragStart
are defined as the starting and stopping points on the x-axis that the draggable area should start and stop.Running
Run the app, and resize the window (or whatever should trigger this). The draggable area at the top of the window should work correctly. Now, maximize the window. The draggable area does not work as expected.
Expected behavior
The draggable area covers the expected, provided area when maximized.
Screenshots
No response
NuGet package version
Windows App SDK 1.5.5: 1.5.240627000
Packaging type
Packaged (MSIX)
Windows version
No response
IDE
Visual Studio 2022
Additional context
The behavior is exhibited in 1.5.5, I was able to reproduce the issue as well in 1.5.4.