While looking for ways to solve the problem of MAUI applications having a grey title bar on Windows, I managed to make the actual, accent-color-respecting title bar reappear by adding a Win32 subclass that intercepts WM_NCCALCIZE
and passes it to DefWindowProc
. Unfortunately, the grey fake title bar added by WinUI3 is still there, which means I have two title bars now (plus the Shell
's navigation bar):
I tried the proposed fix of setting ExtendsContentIntoTitleBar
and calling SetTitleBar
on the WinUI Window:
var myTitleBar = new Microsoft.UI.Xaml.Controls.TextBlock() {
Name="DummyTitleBar",
Text="Dummy title bar"
};
winuiContentContainer.Children.Add(myTitleBar);
winuiWindow.ExtendsContentIntoTitleBar = true;
winuiWindow.SetTitleBar(myTitleBar);
Unfortunately, instead of replacing the grey title bar with the dummy UIElement
(that I planned to later swap for something like a 1-pixel line), it merely draws the element over the grey fake title bar:
I need a way to make the grey fake title bar disappear for good (or at least significantly reduce its height) without harming the real title bar, or cover it with the Shell
. Only on Windows, of course.
Edit: To reiterate from the other question, I'm on Windows 10, so I can't use AppWindow.TitleBar
which works only on Windows 11.