/// <summary> /// Event handler for the <see cref="PreviewDrop"/> event /// </summary> /// <param name="sender">the sender of the event</param> /// <param name="e">the <see cref="DragEventArgs"/> associated to the event</param> /// <remarks> /// Occurs when the input system reports an underlying drop event with this element as the drop target. /// </remarks> private void PreviewDrop(object sender, DragEventArgs e) { this.dropInfo = new DiagramDropInfo(sender, e) { DiagramDropPoint = this.GetDiagramPositionFromMousePosition(this.dropInfo.DropPosition) }; var dropTarget = this.AssociatedObject.DataContext as IDropTarget; if (dropTarget != null) { dropTarget.Drop(this.dropInfo); e.Handled = true; } }
/// <summary> /// Event handler for the <see cref="PreviewDragOver"/> event /// </summary> /// <param name="sender">the sender of the event</param> /// <param name="e">the <see cref="DragEventArgs"/> associated to the event</param> /// <remarks> /// Occurs when the input system reports an underlying drag event with this element as the potential drop target. /// </remarks> private void PreviewDragOver(object sender, DragEventArgs e) { this.dropInfo = new DiagramDropInfo(sender, e); var dropTarget = this.AssociatedObject.DataContext as IDropTarget; if (dropTarget != null) { dropTarget.DragOver(this.dropInfo); e.Effects = this.dropInfo.Effects; e.Handled = true; } var dependencyObject = sender as DependencyObject; if (dependencyObject != null) { this.Scroll(dependencyObject, e); } }
/// <summary> /// Event handler for the <see cref="PreviewDragLeave"/> event /// </summary> /// <param name="sender">the sender of the event</param> /// <param name="e">the <see cref="DragEventArgs"/> associated to the event</param> /// <remarks> /// Occurs when the input system reports an underlying drag event with this element as the drag origin. /// </remarks> private void PreviewDragLeave(object sender, DragEventArgs e) { this.dropInfo = null; e.Handled = true; }