Skip to content

TitleBar control calculation of padding is incorrect #10344

Open
@lhak

Description

Describe the bug

The titlebar control does not take the scale factor into account when calculating the widths of the columns used for padding, resulting in incorrect positioning of elements.

Steps to reproduce the bug

The code here:

if (const auto rightColumn = m_rightPaddingColumn.get())
{
const auto rightColumnInset =
FlowDirection() == winrt::FlowDirection::LeftToRight ?
appTitleBar.RightInset() :
appTitleBar.LeftInset();
TITLEBAR_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
L"RightColumn width:",
rightColumnInset);
rightColumn.Width(winrt::GridLengthHelper::FromPixels(rightColumnInset));

needs to take the scale factor into account by dividing rightColumnInset (value in physical pixels) by the scale factor.

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.7 Preview 1: 1.7.250208002-preview1

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions