question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Caption Buttons do not work on certain platforms when content extended into titlebar

See original GitHub issue

Describe 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:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pratikonecommented, Mar 31, 2022

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.

1reaction
pratikonecommented, Mar 31, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caption Buttons do not work when content is extended into ...
I'm running on windows 11. Which version are you testing now? After removing the style, and changing the background to red, I could...
Read more >
Custom title bar not working in Unpackaged mode of ...
Hi, I have created Winui3vApp with custom title bar by using below ... default caption buttons works in packaged mode but not working...
Read more >
Customize the window controls overlay of your PWA's title bar
With the Window Controls Overlay feature, developers can customize the title bar of installed PWAs so that their PWAs feel more like apps....
Read more >
Navigation bars | Apple Developer Documentation
A navigation bar appears at the top of a window or screen, helping people navigate through a hierarchy of content.
Read more >
Format Titles, Captions, Tooltips, and Legends
If a title or caption isn't showing, open the Worksheet menu and select Show Title or Show Caption. For dashboards and stories, there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found