internal static IWindow?GetWindowForXamlRoot(XamlRoot?root) { if (root is null) { return(null); } var windows = WindowExtensions.GetWindows(); foreach (var window in windows) { if (window.Handler?.PlatformView is Microsoft.UI.Xaml.Window win) { if (win.Content?.XamlRoot == root) { return(window); } } } return(null); }
internal static IWindow?GetHostedWindow(this UIWindow?uiWindow) { if (uiWindow is null) { return(null); } var windows = WindowExtensions.GetWindows(); foreach (var window in windows) { if (window.Handler?.PlatformView is UIWindow win) { if (win == uiWindow) { return(window); } } } return(null); }