Beispiel #1
0
 // Adorners
 // Creates or updates the dragged Adorner.
 private void ShowDraggedAdorner(Point currentPosition)
 {
     if (draggedAdorner == null) {
         AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(sourceItemsControl);
         draggedAdorner = new DraggedAdorner(draggedData, GetDragDropTemplate(sourceItemsControl),
                                             sourceItemContainer, adornerLayer);
     }
     try {
         draggedAdorner.SetPosition(currentPosition.X - initialMousePosition.X + initialMouseOffset.X,
                                    currentPosition.Y - initialMousePosition.Y + initialMouseOffset.Y);
     } catch(InvalidOperationException) {
         throw new InvalidOperationException();
     }
 }
Beispiel #2
0
 private void RemoveDraggedAdorner()
 {
     if (draggedAdorner != null) {
         draggedAdorner.Detach();
         draggedAdorner = null;
     }
 }