private void OnLeavePopupTimerCallback(object sender, EventArgs e) { _leavePopupTimer.Stop(); var mousePnt = MouseUtilities.GetMousePosition(this); if (PopupBaseRect.Contains(mousePnt)) { return; } Popup popup; if (!opened_popups.TryGetValue(this, out popup) || popup == null || popup.IsMouseOver) { return; } closeAllPopups(popup); }
private void OnLeavePopupFromPopupTimerCallback(object sender, EventArgs e) { _leavePopupFromPopupTimer.Stop(); var parent = _leavePopupFromPopupTimer.Tag as Popup; if (parent == null) { return; } var popup = parent.Child as FrameworkElement; if (popup == null) { return; } var pc = parent.Tag as PopupContainer; var bounds = pc == null || pc.PopupRect == Rect.Empty ? VisualTreeHelper.GetDescendantBounds(popup) : pc.PopupRect; var mousePnt = MouseUtilities.GetMousePosition(popup); if (bounds.Contains(mousePnt)) { return; } mousePnt = MouseUtilities.GetMousePosition(this); if (PopupBaseRect.Contains(mousePnt)) { return; } closeAllPopups(parent); }