private void OnPopupDismiss(object sender, DismissPopupEventArgs e) { var backstage = LogicalTreeHelper.GetParent(this); if (backstage != null) { PopupService.RaiseDismissPopupEventAsync(backstage, DismissPopupMode.Always); } }
/// <summary> /// Handles dismiss popup event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnDismissPopup(object sender, DismissPopupEventArgs e) { IDropDownControl control = sender as IDropDownControl; if (control == null) { return; } if (e.DismissMode == DismissPopupMode.Always) { if (Mouse.Captured == control) { Mouse.Capture(null); } // Debug.WriteLine("DropDown Closed"); control.IsDropDownOpen = false; } else { if ((control.IsDropDownOpen) && (!PopupService.IsMousePhysicallyOver(control.DropDownPopup.Child))) { if (Mouse.Captured == control) { Mouse.Capture(null); } // Debug.WriteLine("DropDown Closed"); control.IsDropDownOpen = false; } else { if ((control.IsDropDownOpen) && (Mouse.Captured != control)) { Mouse.Capture(sender as IInputElement, CaptureMode.SubTree); } if (control.IsDropDownOpen) { e.Handled = true; } } } }
private void OnPopupDismiss(object sender, DismissPopupEventArgs e) { this.IsOpen = false; }