// Creates or updates the dragged Adorner. private void ShowDraggedAdorner(Point currentPosition) { if (this.draggedAdorner == null) { var decorator = OverlayAdornerDecorator.FindOverlayAdornerDecorator(this.sourceItemsControl); var adornerLayer = AdornerLayer.GetAdornerLayer(decorator); this.draggedAdorner = new DraggedAdorner(this.draggedData, GetDragDropTemplate(this.sourceItemsControl), this.sourceItemContainer, adornerLayer); } this.draggedAdorner.SetPosition(currentPosition.X - this.initialMousePosition.X + this.initialMouseOffset.X, currentPosition.Y - this.initialMousePosition.Y + this.initialMouseOffset.Y); // event: drag started this.sourceItemsControl.RaiseEvent(new AdornerOpenEventArgs() { Data = this.draggedData }); }
private void RemoveDraggedAdorner() { if (this.draggedAdorner != null) { this.draggedAdorner.Detach(); this.draggedAdorner = null; } // event: drag stop this.sourceItemsControl.RaiseEvent(new AdornerClosedEventArgs()); }