Skip to content

[Documentation] AppWindowTitleBar uses physical pixels #2047

@simon-knuth

Description

@simon-knuth

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

Metadata

Metadata

Assignees

Labels

area-WindowingTopics related to the Windowing API in Windows App SDK, including AppWindow, presenters, etc.documentationImprovements or additions to documentationfeature proposal

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions