public static float GetDisplayDensity(this UI.Xaml.Window platformWindow) { var hwnd = platformWindow.GetWindowHandle(); if (hwnd == IntPtr.Zero) { return(1.0f); } return(PlatformMethods.GetDpiForWindow(hwnd) / DeviceDisplay.BaseLogicalDpi); }
public static UI.Windowing.AppWindow?GetAppWindow(this UI.Xaml.Window platformWindow) { var hwnd = platformWindow.GetWindowHandle(); if (hwnd == IntPtr.Zero) { return(null); } var windowId = UI.Win32Interop.GetWindowIdFromWindow(hwnd); return(UI.Windowing.AppWindow.GetFromWindowId(windowId)); }