private void OnDockableWorkspaceBeforePageDrag(object sender, PageDragCancelEventArgs e) { // Validate the list of names to those that are still present in the dockspace List <KryptonPage> pages = new List <KryptonPage>(); foreach (KryptonPage page in e.Pages) { if (!(page is KryptonStorePage) && (DockableWorkspaceControl.CellForPage(page) != null)) { pages.Add(page); } } // Only need to start docking dragging if we have some valid pages if (pages.Count != 0) { // Ask the docking manager for a IDragPageNotify implementation to handle the dragging operation KryptonDockingManager dockingManager = DockingManager; if (dockingManager != null) { dockingManager.DoDragDrop(e.ScreenPoint, e.ElementOffset, e.Control, e.Pages); } } // Always take over docking e.Cancel = true; }
/// <summary> /// Find the docking element that contains the location specific store page for the named page. /// </summary> /// <param name="location">Location to be searched.</param> /// <param name="uniqueName">Unique name of the page to be found.</param> /// <returns>IDockingElement reference if store page is found; otherwise null.</returns> public override IDockingElement FindStorePageElement(DockingLocation location, string uniqueName) { if (location == DockingLocation.Workspace) { KryptonPage page = DockableWorkspaceControl.PageForUniqueName(uniqueName); if (page is KryptonStorePage) { return(this); } } return(null); }
/// <summary> /// Find the docking element that contains the named page. /// </summary> /// <param name="uniqueName">Unique name of the page.</param> /// <returns>IDockingElement reference if page is found; otherwise null.</returns> public override IDockingElement FindPageElement(string uniqueName) { KryptonPage page = DockableWorkspaceControl.PageForUniqueName(uniqueName); if ((page != null) && !(page is KryptonStorePage)) { return(this); } else { return(null); } }
/// <summary> /// Find the docking location of the named page. /// </summary> /// <param name="uniqueName">Unique name of the page.</param> /// <returns>Enumeration value indicating docking location.</returns> public override DockingLocation FindPageLocation(string uniqueName) { KryptonPage page = DockableWorkspaceControl.PageForUniqueName(uniqueName); if ((page != null) && !(page is KryptonStorePage)) { return(DockingLocation.Workspace); } else { return(DockingLocation.None); } }
/// <summary> /// Propagates a request for drag targets down the hierarchy of docking elements. /// </summary> /// <param name="floatingWindow">Reference to window being dragged.</param> /// <param name="dragData">Set of pages being dragged.</param> /// <param name="targets">Collection of drag targets.</param> public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow, PageDragEndData dragData, DragTargetList targets) { // Create list of the pages that are allowed to be dropped into this workspace KryptonPageCollection pages = new KryptonPageCollection(); foreach (KryptonPage page in dragData.Pages) { if (page.AreFlagsSet(KryptonPageFlags.DockingAllowWorkspace)) { pages.Add(page); } } // Do we have any pages left for dragging? if (pages.Count > 0) { DragTargetList workspaceTargets = DockableWorkspaceControl.GenerateDragTargets(new PageDragEndData(this, pages), KryptonPageFlags.DockingAllowWorkspace); targets.AddRange(workspaceTargets.ToArray()); } }