WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

[Documentation] AppWindowTitleBar uses physical pixels

Open simon-knuth opened this issue 3 years ago • 1 comments

Describe the bug

AppWindowTitleBar uses physical pixels instead of effective pixels, which can be quite unintuitive when you're calculating the rectangles based on the XAML layout. All values need to be scaled using XamlRoot.RasterizationScale to prevent issues on displays that aren't using a scaling factor of 1 (100%).

With WinUI being a departure from physical pixels, this behavior should imo be mentioned in the documentation, which impacts at least the following pages:

  1. AppWindowTitleBar.SetDragRectangles(RectInt32[])
  2. AppWindowTitleBar.LeftInset
  3. AppWindowTitleBar.RightInset
  4. Perhaps also AppWindowTitleBar.Height, not sure

This issue was raised among some other AppWindowTitleBar quirks here as well.

Steps to reproduce the bug

Use the given method/properties in code and observe the values/behavior.

Expected behavior

No response

Screenshots

No response

NuGet package version

1.0.0

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 21H2 (22000)

IDE

Visual Studio 2022

Additional context

No response

simon-knuth avatar Feb 01 '22 13:02 simon-knuth

Does this also mean we need to handle it and update the rectangles when dragging a window across two monitors with different DPI? (and how would that affect the drag, changing the area I'm actively dragging?)

dotMorten avatar Sep 07 '22 20:09 dotMorten