-
Notifications
You must be signed in to change notification settings - Fork 760
Open
Labels
area-TitleBarIssues related to custom window title bars.Issues related to custom window title bars.bugSomething isn't workingSomething isn't working
Description
Describe the bug
As per the documentation, 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
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="App1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:App1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="App1"
mc:Ignorable="d">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<Border>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock
x:Name="Output"
HorizontalAlignment="Center"
Text="Default" />
<StackPanel
HorizontalAlignment="Center"
Orientation="Horizontal"
Spacing="12">
<Button
x:Name="Restore"
Click="Restore_Click"
Content="Restore" />
<Button
x:Name="Custom"
Click="Custom_Click"
Content="Custom" />
</StackPanel>
</StackPanel>
</Border>
</Window>
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
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
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
Video.mp4
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
Jay-o-Way and riverar
Metadata
Metadata
Assignees
Labels
area-TitleBarIssues related to custom window title bars.Issues related to custom window title bars.bugSomething isn't workingSomething isn't working
Type
Projects
Status
Ready