/// <summary> /// Perform the drop action associated with the target. /// </summary> /// <param name="screenPt">Position in screen coordinates.</param> /// <param name="data">Data to pass to the target to process drop.</param> /// <returns>Drop was performed and the source can perform any removal of pages as required.</returns> public override bool PerformDrop(Point screenPt, PageDragEndData data) { // Find our docking edge KryptonDockingEdge dockingEdge = null; switch (Edge) { case VisualOrientation.Left: dockingEdge = ControlElement["Left"] as KryptonDockingEdge; break; case VisualOrientation.Right: dockingEdge = ControlElement["Right"] as KryptonDockingEdge; break; case VisualOrientation.Top: dockingEdge = ControlElement["Top"] as KryptonDockingEdge; break; case VisualOrientation.Bottom: dockingEdge = ControlElement["Bottom"] as KryptonDockingEdge; break; } // Find the docked edge KryptonDockingEdgeDocked dockedEdge = dockingEdge?["Docked"] as KryptonDockingEdgeDocked; KryptonDockingManager manager = dockedEdge?.DockingManager; if (manager != null) { // Create a list of pages that are allowed to be transferred into the dockspace List <KryptonPage> transferPages = new List <KryptonPage>(); List <string> transferUniqueNames = new List <string>(); foreach (KryptonPage page in data.Pages) { if (page.AreFlagsSet(KryptonPageFlags.DockingAllowDocked)) { // Use event to indicate the page is becoming docked and allow it to be cancelled CancelUniqueNameEventArgs args = new CancelUniqueNameEventArgs(page.UniqueName, false); manager?.RaisePageDockedRequest(args); if (!args.Cancel) { transferPages.Add(page); transferUniqueNames.Add(page.UniqueName); } } } // Transfer valid pages into the new dockspace if (transferPages.Count > 0) { // Convert the incoming pages into store pages for restoring later manager.PropogateAction(DockingPropogateAction.StorePages, transferUniqueNames.ToArray()); // Create a new dockspace at the start of the list so it is closest to the control edge KryptonDockingDockspace dockspace = (_outsideEdge ? dockedEdge.InsertDockspace(0) : dockedEdge.AppendDockspace()); // Add pages into the target dockspace.Append(transferPages.ToArray()); return(true); } } return(false); }