Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the titlebar control back button visible through C# for the first time allows it to be dragged and removes animation #10350

Open
RyanLua opened this issue Feb 13, 2025 · 2 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@RyanLua
Copy link

RyanLua commented Feb 13, 2025

Describe the bug

When you set the TitleBar back button visible through C# (not XAML) the first time, it allows you to drag the window by the back button and removes the back button animation.

Steps to reproduce the bug

  1. Create a titlebar control in XAML with the back button IsBackButtonVisible false
  2. In the .xaml.cs file, set the IsBackButtonVisible to true
  3. Observe that you can drag the window by the back button and the animation is removed

Minimum reproduction:
https://github.com/RyanLua/TitlebarTest/tree/main/TitlebarTest

Expected behavior

Setting the back button in the titlebar control should retain the same behaviors as when setting it through XAML.

Screenshots

20250213-2248-11.1859949.mp4

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

If you ser the back button invisible and set it visible it again, it works like normal as expected. The first time you make the back button visible is when it is in this bugged state.

@RyanLua RyanLua added the bug Something isn't working label Feb 13, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 13, 2025
@RyanLua RyanLua changed the title Enabling the titlebar control back button through C# allows it to be dragged and removes animation Enabling the titlebar control back button through C# for the first time allows it to be dragged and removes animation Feb 13, 2025
@niels9001
Copy link
Contributor

@RyanLua I'm able to reproduce the issue, but the first repro step is incorrect (should be IsVisible, not IsEnabled). It also seems it's missing from your repro project?

Here are the repro steps I used:

  1. Launch the app (IsBackButtonVisible is set to False in XAML).
  2. Set IsBackButtonVisible to true in C# with the toggle.
  3. Click the Back button; it drags the window and no BackRequested event.
  4. Click it again; the BackRequested event gets triggered but animation/pressed state is not shown.
  5. Maximize the window or toggle on/off again fix it.

Repro project (fork):
https://github.com/niels9001/TitlebarTest

@stevenbrix
Copy link
Contributor

In case it's helpful to MS, this seems to have regressed between Experimental3 and Preview1

@RyanLua RyanLua changed the title Enabling the titlebar control back button through C# for the first time allows it to be dragged and removes animation Setting the titlebar control back button visible through C# for the first time allows it to be dragged and removes animation Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

3 participants