[Preview 4] SetTitleBar does not always work
See original GitHub issueDescribe the bug I created a custom TitleBar using an UserControl. In the main Window I have a Grid which contains a Frame and the UserControl of the TitleBar.
The exact order is:
<Grid x:Name="MainWindowGrid" TabIndex="0" IsTabStop="True" IsTapEnabled="True">
<Frame x:Name="MainWindowFrame"/>
<userControl:TitleBarControl x:Name="MainTitleBar" VerticalAlignment="Top"/>
</Grid>
I tried to set the custom TitleBar using SetTitleBar, but nothing changes. When I try to grab and move the Window from the TitleBar UserControl nothing happens.
Steps to reproduce the bug
Steps to reproduce the behavior:
- Create a Window
- Insert a Grid
- Insert a Frame and an UserControl (which will behave as the TitleBar) in the Grid
- Set the UserControl using SetTitleBar
- Try to move the Window
Expected behavior Grabbing the TitleBar would allow the user to move around the Window
Screenshots
Version Info Win32 WinUI 3 Preview 4
NuGet package version: Microsoft.WinUI 3.0.0-preview4.210210.4
Windows app type:
UWP | Win32 |
---|---|
Yes |
Windows 10 version | Saw the problem? |
---|---|
Insider Build (xxxxx) | |
October 2020 Update (19042) | Yes |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | Yes |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Xbox | |
Surface Hub | |
IoT |
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Title bar customization - Windows apps
Customize the title bar of a desktop app to match the personality of the app.
Read more >UWP extend into title bar - default title bar converting back ...
Somehow I fixed it by moving the settitlebar(grid) above InitializeComponent() . Martin - If I don't set the color it makes the window...
Read more >Modding Mac OS X: Extreme Makeovers for Your Mac
Although Stickies does not contain any examples of this kind , you can easily imagine a pair such as hasTitlebar and setTitlebar :....
Read more >Matplotlib 3.0 Cookbook: Over 150 recipes to create highly ...
When there are more than nine plots in the grid, the later notation is confusing, and Matplotlib does not accept it. In such...
Read more >Microsoft release Windows UI Library 3 Preview 4
Released today, WinUI 3 Preview 4 is a stability preview release that includes ... ApplicationView and all related APIs will no longer work....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jeff-kissinger I’m trying the same thing injecting a custom header title bar element and my header element covers the system title bar buttons. They are still there if I render the header semi-transparently.
If I try to put a margin on my header title bar element to give the system title bar buttons room to render, I found that they seem to “move” to top-right align within my title bar element. So if your header title bar element has a background, it seems to always block them. This doesn’t feel like it’s implemented right yet.
From a consumer point of view, I love the option of extending custom content into the title bar (we did that in UWP too). But…
I don’t have much experience on WinUI Desktop side, but in regular UWP world your draggable area should respect the margin values returned by LayoutMetricsChanged event in core title bar. It’s documented here. I assume we don’t have in Desktop world.
I tried your code and it’s working for me on WinUI Desktop project. However, they are invisible as stated also in this issue.
Few more notes that might be helpful for you when creating custom draggable area from UWP world:
I just wanted to mention that the issue here is invisible system buttons and the notes above can help WinUI dev team to diagnose potential bugs. There might be places that have been forgotten during the process of unification for both code bases 😃