microsoft / microsoft/microsoft-ui-xaml

Window.SetTitleBar(null) does not restore the default drag region.

Open
#10,694 0 comments 3 reactions 0 assignees View on GitHub
area-TitleBar bug team-Core
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

As per the [documentation](https://learn.microsoft.com/en-us/windows/apps/develop/title-bar#reset-the-title-bar), calling `SetTitleBar(null)` should reset the drag region to default. However, it does so **only if** ExtendsContentIntoTitleBar is toggled after calling it.

### Steps to reproduce the bug

```xaml












```
```csharp
using Microsoft.UI.Xaml;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace App1
{
///
/// An empty window that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
ExtendsContentIntoTitleBar = true;
}

private void Restore_Click(object sender, RoutedEventArgs e)
{
Output.Text = "Default";
SetTitleBar(null);

// It wouldn't work unless the following lines are uncommented.
// i.e., the `Content` still responds to drag after executing the above lines.
// ExtendsContentIntoTitleBar = false;
// ExtendsContentIntoTitleBar = true;
}

private void Custom_Click(object sender, RoutedEventArgs e)
{
Output.Text = "Custom";
SetTitleBar(Content);
}
}
}
```

### Expected behavior

SetTitleBar(null) should restore the default drag region.

### Screenshots

https://github.com/user-attachments/assets/57692f3d-022c-43ed-800a-02a99fb6c390

### NuGet package version

WinUI 3 - Windows App SDK 1.7.3: 1.7.250606001

### Windows version

Windows 11 (24H2): Build 26100

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided XAML and C# example on Windows 11 with Windows App SDK 1.7.3, focusing on the interaction between SetTitleBar(null) and ExtendsContentIntoTitleBar. Trace the WinUI Window title-bar handling and identify why resetting the title bar does not immediately restore the default drag region. Done means SetTitleBar(null) restores the documented default behavior without toggling ExtendsContentIntoTitleBar.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.