microsoft-ui-xaml
microsoft-ui-xaml copied to clipboard
ExtendsContentIntoTitleBar and wrong window top border color
Describe the bug
In WinUI 3 project, the top border of window is drawn black when ExtendsContentIntoTitleBar is true.
Steps to reproduce the bug
- Create 'Blank App, Packaged (with WinUI 3 in Desktop)'
- Set
ExtendsContentIntoTitleBartotruein the MainWindow constructor
Expected behavior
No response
Screenshots

NuGet package version
WinUI 3 - Windows App SDK 1.0
Windows app type
- [ ] UWP
- [x] Win32
Device form factor
Desktop
Windows version
Windows 10 (21H2): Build 19044
Additional context
No response
Any progress on this issue?

bump
This bug is still present in the 1.1 version.
Any developer's comment? Nope?
A workaround:
using System;
using System.Runtime.InteropServices;
using WinRT.Interop;
public sealed partial class MainWindow : Window {
[StructLayout(LayoutKind.Sequential)]
struct MARGINS {
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
}
[DllImport("dwmapi")]
static extern IntPtr DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
public MainWindow() {
var handle = WindowNative.GetWindowHandle(this);
var margins = new MARGINS { cxLeftWidth = 0, cxRightWidth = 0, cyBottomHeight = 0, cyTopHeight = 2 };
Activated +=
(object sender, WindowActivatedEventArgs args) => DwmExtendFrameIntoClientArea(handle, ref margins);
ExtendsContentIntoTitleBar = true;
}
// ...
}
Additional bug related to this wrong border.
If you want to disable resizing for your app and add the code:
if (appWindow.Presenter is OverlappedPresenter p)
p.IsResizable = false;
then the side and bottom borders will not support resizing and won't show the resizer cursor, but the top border will still show the resize cursor (but resizing will not actually work):

@pavel-zhukov your fix deals with both issues - it fixes the color and also gets rid of the wrong resize cursor.
I hope the team will do something about it; these hacks are ugly.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is still an Issue, not sure if its WinUI 3 related, or WinAppSDK https://github.com/microsoft/microsoft-ui-xaml/issues/8743
I would close this issue because the other issue mentioned here is more accurate : in high contrast setting, parts of top border is missing. I would follow that issue to track it. Closing it as dup.
So where exactly is this going to be fixed?
It is in the pipeline of the team and should be done in a future release. The developers will update the high contrast bug if it is fixed internally and with the tag of build it will be coming in .