-
-
Notifications
You must be signed in to change notification settings - Fork 657
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
Part of title bar is still rendered when it should not #595
Comments
Take a look at the development branch, does the problem persist? |
Interesting. I even asked my friend to try and he got the same results. Maybe there's more to it then. |
It only seems to occur when the window is focused. Anyone has a workaround yet? |
The ProblemThis is caused by the user's Accent color being applied to the Window's titlebar. SolutionsThe quick workaround is to not have If you don't want to change the setting via the Settings app, you can either do this directly in the Registry using Using Open Using # check current ColorPrevalence setting
Get-ItemPropertyValue -Path 'HKCU:\Software\Microsoft\Windows\DWM' -Name 'ColorPrevalence'
# disable ColorPrevalence (Accent colors on window titlebars and borders)
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\DWM\' -Name 'ColorPrevalence' -Type DWord -Value 0 Other MethodsAside from (Actually) Solving the ProblemOther than turning that Personalization setting off, there's likely a native Win32 API call that can be used to disable the title bar coloring with DWM. If I have some extra free time I'll see if I can put something together but for now here's a link to the documentation from Microsoft. |
Isn't it possible to set a window style that removes the titlebar, for a quick and dirty work-around? |
Workaround: Put this into the MainWindow constructor:
The idea is that the window handle should be created before This is because underneath there is a call to In general I think that the whole idea of "lazy" window initialization is flawed. |
Should be 32, but #details :) |
Actually at least on my PC the height of the accent colored bar is 30px exactly How did you get 32px @Jay-o-Way? |
Well, I mean, according to the design... https://learn.microsoft.com/windows/apps/design/basics/titlebar-design#standard-design |
Interesting - an old wpf app without wpf-ui actually has 31px of accented colored titlebar while in my wpf-ui test app it's only 30px Perhaps that 32px includes a border? But you're right - after further testing although the accented area is only 30px high, only by making ui:titlebar 31px high does it cover the full accented area - and if i need an extra pixel that indicates theres actually a different colored border - so 32px is the correct height to use |
The fix for this issue is to use DwmSetWindowAttribute to set the DWMWA_CAPTION_COLOR attribute to 0xFFFFFFFE - this causes the title bar colour to not show when the mica effect is enabled with DWMWA_SYSTEMBACKDROP_TYPE (I'm assuming this is what wpfui uses to enable the mica effect.). However, this behaviour is undocumented here. I'm assuming this is what Notepad does as it has a mica effect in the title bar but doesn't have this issue. |
Fixed |
Describe the bug
I recently started using the library, and whilst working on Windows 10 machine everything looked as expected. When I moved my work to Windows 11, I noticed some part of the title bar is rendered, even when shouldn't. Attaching examples of that reproduced for the WPF UI Gallery. I have not yet found any workarounds to remove it in my app too.
To Reproduce
Start WPF UI Gallery or demo app.
Expected behavior
No additional elements in the title bar.
Screenshots
Windows 10:
![Win10](https://user-images.githubusercontent.com/7910223/232444483-8cd05dac-3da1-483a-bc60-ff436d130422.jpg)
Windows 11:
![Win11](https://user-images.githubusercontent.com/7910223/232444558-638fb6ed-1ae7-48a9-b344-e3ac81074e4c.jpg)
OS version
Edition Windows 11 Home
Version 22H2
Installed on 22/10/13
OS build 22621.1555
Experience Windows Feature Experience Pack 1000.22640.1000.0
.NET version
7.0
WPF-UI NuGet version
2.0.3
Additional context
No response
The text was updated successfully, but these errors were encountered: