public override void Show() { UnmanagedMethods.ShowWindow(Handle.Handle, UnmanagedMethods.ShowWindowCommand.ShowNoActivate); // We need to steal focus if it's held by a child window of our toplevel window var parent = _parent; while (parent != null) { if (parent is PopupImpl pi) { parent = pi._parent; } else { break; } } if (parent == null) { return; } var focusOwner = UnmanagedMethods.GetFocus(); if (focusOwner != IntPtr.Zero && UnmanagedMethods.GetAncestor(focusOwner, UnmanagedMethods.GetAncestorFlags.GA_ROOT) == parent.Handle.Handle) { UnmanagedMethods.SetFocus(parent.Handle.Handle); } }