-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending to titlebar is not working as expected (WinAppSDK 1.0.1) #6858
Comments
@bpulliam @pratikone please take a look |
refer response in #6895 1084868757. Margin is the issue. It was a workaround earlier for a issue which has now been fixed. working with docs team to get the sample code updated. |
@pratikone What about the smoke layer? Can't we get rid of that? The whole idea of extending the content to the titlebar is to blend the titlebar and the content and have the same background/material |
In the App.xaml file you can set the "smoke layer" to transparent:
More codes:
|
@lakienvinh, this works for me, however, I noticed another issue, if I switch to the dark mode (programatically setting RequestedTheme) even after extending the content into titlebar I still see a light titlebar in light and dark content. @pratikone any idea what is going on there? |
yes. it puzzled me too. TBH, i don't know how that came to be. good news is i made a series of new changes for separate reasons and this issue went away. it will come in a future . feel free to open this issue if it doesn't get fixed in next 1-2 releases. |
To enable that familiar WinUI 3 titlebar, these 3 code snippets need to be added to the project: - `MainWindow.xaml.cs`: Check this method: `EnableModernTitlebar()` - `MainWindow.xaml`: Check for the Border control with name `appTitleBar` - `App.xaml`: This part is needed to achieve a true black color in the titlebar... Source found [here](microsoft/microsoft-ui-xaml#6858 (comment)) ``` <SolidColorBrush x:Key="WindowCaptionBackground" Color="#121212"/> <SolidColorBrush x:Key="WindowCaptionBackgroundDisabled" Color="#121212"/> ``` Also, running the app in Unpackaged mode, is only possible when this property is set to true in the project config file (`EpicGamesAccountSwitcher.csproj`). Put it in the main `<PropertyGroup>`: `<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>`
Describe the bug
After following the titlebar customisation for a WinUI 3, WinAppSDK 1.0.1 app, following observations are made
[1] Setting the title bar with a
Margin=0,0,120,0
A gray overlay is displayed over the titlebar, except at the either end of the titlebar, both left and right. On
Right
it is expected as margin of 120 is given but why left.System control buttons (min, max, close) don't function either
![image](https://user-images.githubusercontent.com/8557046/159164623-ce3ffe64-2198-4070-bbdd-85b286a08642.png)
Changing the
![image](https://user-images.githubusercontent.com/8557046/159164700-168a926a-9043-43c5-9032-ad6c471c2537.png)
Margin=0,0,12,0
also changes the margin on both ends, not just right.[2] Setting the title bar with a
Margin=0,0,0,0
Steps to reproduce the bug
Expected behavior
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.0
Windows app type
Device form factor
Desktop
Windows version
Windows 10 (20H2): Build 19042
Additional context
I am not using the single project packaged solution, but updated my earlier project with two csproj to 1.0.1 SDK.
The text was updated successfully, but these errors were encountered: