[WinUI3]Fix Windows 10 title bar borders (#36429)

* Fix borders for windows in the Settings UI

* Fix HOSTS window

* Fix Advanced Paste

* Fix Environment Variables

* Fix File Locksmith

* Fix Peek, with a caveat

* Fix Registry Preview

* Remove unused imports

* Clean up imports in OobeShellPage

* Move OSVersionHelper from Common.UI up into ManagedCommon
This commit is contained in:
Neil McAlister
2025-01-13 17:13:16 +02:00
committed by GitHub
parent aa9f3bb540
commit df48a33bb9
23 changed files with 68 additions and 25 deletions

View File

@@ -38,8 +38,8 @@ namespace RegistryPreview
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");
@@ -49,6 +49,7 @@ namespace RegistryPreview
// Extend the canvas to include the title bar so the app can support theming
ExtendsContentIntoTitleBar = true;
WindowHelpers.ForceTopBorder1PixelInsetOnWindows10(windowHandle);
SetTitleBar(titleBar);
// if have settings, update the location of the window