microsoft / microsoft/WindowsAppSDK
[Documentation] AppWindowTitleBar uses physical pixels
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
### Describe the bug
AppWindowTitleBar uses physical pixels instead of [effective pixels](https://docs.microsoft.com/en-us/windows/apps/design/layout/screen-sizes-and-breakpoints-for-responsive-design#effective-pixels-and-scale-factor), 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[])](https://docs.microsoft.com/de-de/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.appwindowtitlebar.setdragrectangles?view=windows-app-sdk-1.0)
2. [AppWindowTitleBar.LeftInset](https://docs.microsoft.com/de-de/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.appwindowtitlebar.leftinset?view=windows-app-sdk-1.0#microsoft-ui-windowing-appwindowtitlebar-leftinset)
3. [AppWindowTitleBar.RightInset](https://docs.microsoft.com/de-de/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.appwindowtitlebar.rightinset?view=windows-app-sdk-1.0#microsoft-ui-windowing-appwindowtitlebar-rightinset)
4. Perhaps also [AppWindowTitleBar.Height](https://docs.microsoft.com/de-de/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.appwindowtitlebar.height?view=windows-app-sdk-1.0#microsoft-ui-windowing-appwindowtitlebar-height), not sure
This issue was raised among some other AppWindowTitleBar quirks [here](https://github.com/microsoft/WindowsAppSDK/issues/1626#issuecomment-1012433294) 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_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.