Skip to content

TitleBar drag areas do not match content after content size changes #11066

@joelspadin

Description

@joelspadin

Describe the bug

When using a TitleBar control and ExtendsContentIntoTitleBar = true, the drag area for the title bar seems to be controlled only by its Content's original size. If the content changes size, the drag areas do not update. The moment you resize the window, it updates to the content's new size.

Additionally, I cannot find any way to indicate that the content is not interactive, so it should be possible to drag the window by the content area.

Why is this important?

I want to display some simple text in the title bar. It isn't interactive, so there's no reason for it to prevent the user from dragging the window. This text initially starts as empty, and then it later updates to display some information. Because the text was originally empty, it is possible to drag anywhere on the title bar, which is what I want, but the moment the window is resized, it updates and the text area can no longer be used to drag.

On the other hand, for controls that are supposed to be interactive, it is odd that the area you can drag doesn't match the locations of the controls if they ever changed size.

Steps to reproduce the bug

  1. Add a TitleBar to the top of a window.
  2. Add a TextBlock to its content.
  3. Bind the text block's text to something that is initially an empty string, then later changes to display text.
  4. In the window's .cs file, set ExtendsContentIntoTitleBar = true and call SetTitleBar(titleBar)
  5. Run the program. Trigger the text block to go from empty to displaying text. You are able to drag the window by clicking on the text block in the title.
  6. Resize the window. You are no longer able to drag the window by clicking on the text block.

Actual behavior

The window can be dragged by the title bar content at first, but then after the window is resized it is not possible to drag it by the content.

Expected behavior

The behavior shouldn't depend on whether the window is resized. It should automatically update when the content's size changes.

It should also be possible to choose whether the content prevents drags, e.g. with IsHitTestVisible = false on the content or with some other property.

Screenshots

No response

NuGet package version

1.8.260317003

Windows version

Windows 11 (24H2): Build 26100

Additional context

(Actual Window version is build 26200)

I have also tried using AppWindow.TitleBar.SetDragRectangles() to make the text in the title bar draggable, but it doesn't seem to have any effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-TitleBarIssues related to custom window title bars.bugSomething isn't working

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions