Caption Buttons do not work on certain platforms when content extended into titlebar
See original GitHub issueDescribe the bug
I have a WInUI 3 application that I migrated from UWP over that extends the content into the titlebar. When I add a margin to the div in the title on certain platforms the caption buttons do no longer work as if they are covered by the div.
I orignally made a StackOverflow post that you can find here: https://stackoverflow.com/questions/71563972/caption-buttons-do-not-work-when-content-is-extended-into-titlebar?noredirect=1#comment126617134_71563972
So far we found out that Windows 10 and some Win11 pc’s it does work, but on others it doesn’t. Also the buttons do react to the click in changing colors, but the action (minimize, maximize or close) is not executed as it seems.
Steps to reproduce the bug
I have a repor sample here: https://1drv.ms/u/s!Ang3D30bKDOhqfQVfrORlAVxleTVeA?e=IqqMyv
The XAML code looks like this:
<Window
x:Class="MoneyFox.Win.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="34" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="AppTitleBar" Margin="0,0,120,0" Background="{ThemeResource TitleBarBrush}">
<TextBlock x:Name="AppTitleTextBlock" Text="Money Fox"
Style="{StaticResource CaptionTextBlockStyle}"
Margin="12,0,0,0" VerticalAlignment="Center" />
</Grid>
<Frame Grid.Row="1" x:Name="ShellFrame" />
</Grid>
</Window>
With the example it works, when I remove Margin="0,0,120,0". Funny enough when I change it to ` Margin=“0,0,60,0” half of the buttons do work.
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.0
Windows app type
- UWP
- Win32
Device form factor
Desktop
Windows version
Windows 11 (21H2): Build 22000
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (6 by maintainers)

Top Related StackOverflow Question
This is intentional. The way custom titlebar works, there is a glass window on top of titlebar area which takes up all the input and does the processing like dragging, clicking, hover. So in case of smoke layer, clicking on smoke layer which is at titlebar area won’t dismiss it because glass window takes up all the input. so we have decided to shift the smoke layer down. this is consistent with how it will appear with system titlebar too. The smoke layer doesn’t cover that area up.
@akbayt even in the older release, the titlebar element should work without the margin. the only issue was that you would have to account layout space for caption buttons.
There should be a difference in windows 10 and 11 versions. Using margins was a workaround for the issue of app content covering up the titlebar area. With new titlebar implementation, it is no longer needed. We are also working to see if we can ignore margin values at all if it is applied to the titlebar element.
Feel free to reach out if you have any more questions.