question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ExtendsContentIntoTitleBar and wrong window top border color

See original GitHub issue

Describe the bug

In WinUI 3 project, the top border of window is drawn black when ExtendsContentIntoTitleBar is true.

Steps to reproduce the bug

  1. Create ‘Blank App, Packaged (with WinUI 3 in Desktop)’
  2. Set ExtendsContentIntoTitleBar to true in the MainWindow constructor

Expected behavior

No response

Screenshots

winui

NuGet package version

WinUI 3 - Windows App SDK 1.0

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:7
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
pavel-zhukovcommented, Jul 31, 2022

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;
  }

  // ...

}
1reaction
Haky00commented, Jun 14, 2022

This bug is still present in the 1.1 version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Title bar showing up white-ish in WinUI 3
In my case, I was able set the tittle bar to the color defined in the xaml by setting the WindowCaptionsBackground and ...
Read more >
Title bar customization - Windows apps
If ExtendsContentIntoTitleBar is set to false , the alpha channel is always ignored for all AppWindowTitleBar color properties. Reference: ...
Read more >
Accent color for window border BUT NOT title bar?
Do export that Registry key before starting to change anything so you can get back to normal if it all starts to go...
Read more >
Line black on top border windows gnome 44
In many applications appear border on top windows: - gnome-shell 44. - fedora 38. - xorg mode or wayland this error/bug appear.
Read more >
How To Change Window Border Color In Windows 10
Change window border color via Color and Appearance​​ Note that this method works only if you already have turned on window border color...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found