void shell_Activated(object sender, EventArgs e) { int count = popupList.Count; if (count > 0) { ModalDialogPopup host = popupList[count - 1]; host.IsOpen = true; } }
void Deque() { IsOpen = false; popupList.Remove(this); int count = popupList.Count; if (count == 0) { myAdorner.Visibility = Visibility.Hidden; return; } ModalDialogPopup top = popupList[count - 1]; top.IsOpen = true; }
void shell_Deactivated(object sender, EventArgs e) { //popups by default are always above all windows //and when the main window loses focus //this looks awkward as well, so instead of pinvoke as //someone else is already doing here : //http://blogs.msdn.com/b/digitalnetbizz/archive/2007/01/11/hmmm-wpf-popup-is-always-top-most.aspx //we'll just hide it? int count = popupList.Count; if (count > 0) { ModalDialogPopup host = popupList[count - 1]; host.IsOpen = false; } }