/// <summary> /// Ends dragging /// </summary> /// <param name="e">The <see cref="T:System.Windows.Input.MouseButtonEventArgs"/> that contains the event data. The event data reports that the mouse button was released.</param> public void OnMouseUp(MouseButtonEventArgs e) { #if SILVERLIGHT #else if (e.ChangedButton == MouseButton.Left) #endif { IsDragging = false; DraggedControl.ReleaseMouseCapture(); //e.Handled = true; DragCompleted(PrevPoint, Vector.SubtractPoints(PrevPoint, DragStartPoint)); } }
/// <summary> /// Initializes dragging /// </summary> /// <param name="e">The <see cref="T:System.Windows.Input.MouseButtonEventArgs"/> that contains the event data. This event data reports details about the mouse button that was pressed and the handled state.</param> public void OnMouseDown(MouseButtonEventArgs e) { DraggedControl.Focus(); #if SILVERLIGHT #else if (e.ChangedButton == MouseButton.Left && Movable && e.ClickCount != 2) #endif { DragStartPoint = e.GetPosition(ExolutioCanvas); PrevPoint = DragStartPoint; MousePoint = new Point(e.GetPosition(ExolutioCanvas).X - e.GetPosition(DraggedControl).X, e.GetPosition(ExolutioCanvas).Y - e.GetPosition(DraggedControl).Y); IsDragging = true; DraggedControl.CaptureMouse(); e.Handled = true; DragStarted(); } }
/// <summary> /// Cancels dragging. /// </summary> public void CancelDrag() { IsDragging = false; DraggedControl.ReleaseMouseCapture(); }