private void OnDrop(object sender, DragDrop.DragEventArgs e) { #if SILVERLIGHT var swimlane = e.Data as SwimlaneShapeBase; #else var swimlane = (e.Data as DataObject).GetData(typeof(SwimlaneShapeBase)) as SwimlaneShapeBase; #endif if (swimlane != null) { var transformedPoint = this.GetTransformedPoint(e.GetPosition(this)); var newPosition = transformedPoint.Substract(swimlane.DragStartOffset); var oldPosition = swimlane.Position; var mainParent = swimlane.ParentContainer as MainContainerShapeBase; if (mainParent != null) { var command = new UndoableDelegateCommand("Remove container from main", new Action<object>((o) => { swimlane.Position = newPosition; mainParent.Items.Remove(swimlane); mainParent.UpdateChildContainers(); }), new Action<object>((o) => { swimlane.Position = oldPosition; mainParent.Items.Add(swimlane); mainParent.UpdateChildContainers(); })); this.UndoRedoService.ExecuteCommand(command); } else { var command = new UndoableDelegateCommand("Remove container from main", new Action<object>((o) => { swimlane.Position = newPosition; }), new Action<object>((o) => { swimlane.Position = oldPosition; })); this.UndoRedoService.ExecuteCommand(command); } } }
protected override void OnManagerDrop(object sender, DragDrop.DragEventArgs e) { this.swimlaneDiagram.HideDragOverVisual(); SwimlaneShapeBase swimlane = this.GetSwimlane(e); if (swimlane != null && this != swimlane) { if (this.ParentMainContainer == null) return; var transformedPoint = (this.Diagram as RadDiagram).GetTransformedPoint(e.GetPosition(this.Diagram as UIElement)); this.ParentMainContainer.MoveTo(swimlane, this.ContainerPosition); if (swimlane.IsPointOverHeaderElement(transformedPoint)) swimlane.keepBackground = true; e.Handled = true; } else if (this.GetMainContainer(e) == null) { base.OnManagerDrop(sender, e); } }