XtraTabbedMdiManager.FloatMDIChildDragging Event
Fires when dragging a floating page. Allows you to implement the drag-and-drop of child floating pages to another XtraTabbedMdiManager.
Namespace: DevExpress.XtraTabbedMdi
Assembly: DevExpress.XtraBars.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DXCategory("Events")]
public event FloatMDIChildDraggingEventHandler FloatMDIChildDragging
Event Data
The FloatMDIChildDragging event's data class is DevExpress.XtraTabbedMdi.FloatMDIChildDraggingEventArgs.
Remarks
The FloatMDIChildDragging event allows you to implement the drag-and-drop of child floating pages to another XtraTabbedMdiManager. This can be accomplished by adding a target XtraTabbedMdiManager object to the event’s e.Targets collection. This collection contains XtraTabbedMdiManager objects that can accept the currently dragged floating page.
When a floating page is dropped over a XtraTabbedMdiManager that is found in the e.Targets collection, the page will automatically be docked to this XtraTabbedMdiManager.
Example
This example demonstrates how to use the XtraTabbedMDIManager.FloatMDIChildDragging event to implement drag-and-drop of MDI children between different XtraTabbedMDIManagers.
using System;
using System.Collections.Generic;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraTabbedMdi;
namespace DevExpress.Samples.DocumentSelector {
public partial class MainForm : XtraForm {
static int index = 0;
public MainForm(StartForm owner) {
index++;
Owner = owner;
InitializeComponent();
Text += index.ToString();
((StartForm)Owner).Register(xtraTabbedMdiManager1);
/*** Floating options ***/
xtraTabbedMdiManager1.FloatOnDoubleClick = DevExpress.Utils.DefaultBoolean.True;
xtraTabbedMdiManager1.FloatOnDrag = DevExpress.Utils.DefaultBoolean.True;
xtraTabbedMdiManager1.FloatPageDragMode = FloatPageDragMode.Preview;
/*** To Show form Icons in page headers ***/
xtraTabbedMdiManager1.UseFormIconAsPageImage = DefaultBoolean.True;
xtraTabbedMdiManager1.BeginFloating += xtraTabbedMdiManager1_BeginFloating;
xtraTabbedMdiManager1.FloatMDIChildDragging += xtraTabbedMdiManager1_FloatMDIChildDragging;
}
protected override void OnClosed(EventArgs e) {
((StartForm)Owner).UnRegister(xtraTabbedMdiManager1);
base.OnClosed(e);
}
void xtraTabbedMdiManager1_FloatMDIChildDragging(object sender, FloatMDIChildDraggingEventArgs e) {
/*
* To allow an XtraTabbedMdiManager to accept a dragged panel,
* the manager needs to be added to the e.Targets collection.
*/
IEnumerable<XtraTabbedMdiManager> dropTargets = ((StartForm)Owner).GetManagers();
foreach(XtraTabbedMdiManager manager in dropTargets)
e.Targets.Add(manager);
}
void xtraTabbedMdiManager1_BeginFloating(object sender, FloatingCancelEventArgs e) {
e.Cancel = false; // Allow all tab pages to be dragged away from XTraTabbedMDIManager
}
void Form1_Load(object sender, EventArgs e) {
if(index % 2 == 0) {
AddChild("Recent", "Shows the recently viewed photos");
AddChild("Favourites", "My favourite photos");
}
else {
AddChild("Published", "These photos are published in my blog");
AddChild("Unsorted", "Not reviewed photos");
}
}
public void AddChild(string category, string tag) {
ChildForm categoryForm = new ChildForm();
categoryForm.Text = category;
categoryForm.MdiParent = this;
categoryForm.Tag = tag;
categoryForm.Show();
}
}
}