protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) { var position = e.GetPosition(this); if (position.X <= CategoryColumnWidth) { _dragHandler = BudgetEditorDragDropHandler.CreateFromEvent(this, e); } else { _dragHandler?.DestroyDragAdorner(); _dragHandler = null; } }
protected override void OnPreviewMouseMove(MouseEventArgs e) { if (_dragHandler != null && e.LeftButton == MouseButtonState.Pressed && !_dragHandler.IsDragging) { var newPoint = e.GetPosition(this); var distance = Point.Subtract(newPoint, _dragHandler.DragStartPosition); if (distance.Length > 4.0) { if (_popupButton != null) { _popupButton.IsPopupOpen = false; _popupButton = null; } _dragHandler.StartDrag(); _dragHandler.DestroyDragAdorner(); _dragHandler = null; } } }