Skip to content
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

Fix Windows 10 title bar borders #36429

Merged
Prev Previous commit
Next Next commit
Fix Registry Preview
  • Loading branch information
pingzing committed Dec 18, 2024
commit 01caed5df01c7d45acdb2d86ab6339db9c0c1076
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ internal MainWindow()
OpenWindowPlacementFile(settingsFolder, windowPlacementFile);

// Update the Win32 looking window with the correct icon (and grab the appWindow handle for later)
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(this);
Microsoft.UI.WindowId windowId = Win32Interop.GetWindowIdFromWindow(windowHandle);
IntPtr windowHandle = this.GetWindowHandle();
WindowId windowId = Win32Interop.GetWindowIdFromWindow(windowHandle);
appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
appWindow.SetIcon("Assets\\RegistryPreview\\RegistryPreview.ico");

Expand All @@ -49,6 +49,7 @@ internal MainWindow()

// Extend the canvas to include the title bar so the app can support theming
ExtendsContentIntoTitleBar = true;
WindowHelpers.ForceTopBorder1PixelInset(windowHandle);
SetTitleBar(titleBar);

// if have settings, update the location of the window
Expand Down