From f74881996f5a77b51d541cc99f310969e68d4b44 Mon Sep 17 00:00:00 2001 From: Mahdi Hosseini Date: Sun, 5 Nov 2023 14:22:24 +0330 Subject: [PATCH] Remove WindowNative and use AppWindow.Id --- components/TitleBar/src/TitleBar.WASDK.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/components/TitleBar/src/TitleBar.WASDK.cs b/components/TitleBar/src/TitleBar.WASDK.cs index fac7a500..43664bd9 100644 --- a/components/TitleBar/src/TitleBar.WASDK.cs +++ b/components/TitleBar/src/TitleBar.WASDK.cs @@ -6,7 +6,6 @@ using Microsoft.UI; using Microsoft.UI.Windowing; using static CommunityToolkit.WinUI.Controls.NativeMethods; -using WinRT.Interop; namespace CommunityToolkit.WinUI.Controls; @@ -173,9 +172,7 @@ public partial class TitleBar : Control private double GetScaleAdjustment() { - IntPtr hWnd = WindowNative.GetWindowHandle(this.Window); - WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd); - DisplayArea displayArea = DisplayArea.GetFromWindowId(wndId, DisplayAreaFallback.Primary); + DisplayArea displayArea = DisplayArea.GetFromWindowId(this.Window.AppWindow.Id, DisplayAreaFallback.Primary); IntPtr hMonitor = Win32Interop.GetMonitorFromDisplayId(displayArea.DisplayId); // Get DPI.