private static DraggableMouseInteraction GetMouseInteraction(MouseEventArgs e) { var uie = PresentationTreeUtils.GetUIElementEventSource(e.OriginalSource); return(uie?.GetVisualAncestorsAndSelf() .OfType <UIElement>() .Select(u => u.GetService <DraggableMouseInteractionService>()) .SkipNull() .SelectMany(s => s._draggableMouseCollection) .Where(d => d.WillHandleEvent(e)) .LastMaxElementOrDefault(d => d.HandlerPriority)); }
private void QueryCloseOnDown(MouseButtonEventArgsInt e) { var uieSource = PresentationTreeUtils.GetUIElementEventSource(e.OriginalSource); var inside = IsInsideClick(uieSource, e); if (inside) { return; } QueryCloseCore(new MouseButtonEventPopupCloseReason(e.OriginalArgs)); }
private static void OnMouseDown(object sender, MouseButtonEventArgs e) { if (e.Handled && e.ClickCount != 1) { return; } var element = (DependencyObject)sender; var uieSource = PresentationTreeUtils.GetUIElementEventSource(e.OriginalSource); if (uieSource.GetVisualAncestors().TakeWhile(p => !ReferenceEquals(p, element)).Any(GetNonSelectable)) { return; } var selectionScope = GetSelectionScope(element); if (selectionScope == null) { return; } selectionScope.SelectedItem = GetSelectTarget(element) ?? element; }
private MouseButtonEventInfo GetMouseDownInfo(MouseButtonEventArgsInt e) { var uie = PresentationTreeUtils.GetUIElementEventSource(e.OriginalSource); return(new MouseButtonEventInfo(uie, IsInsideClick(uie, e))); }