We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Prevent docking onto main form

Thread ID:

Created:

Updated:

Platform:

Replies:

61032 May 16,2007 11:17 PM UTC Jul 16,2007 01:27 PM UTC WinForms 3
loading
Tags: Tools
Peter Capiral
Asked On May 16, 2007 11:17 PM UTC

I have a Form, which contains the DockingManager. Is there a way to disable docking to the main form? I have disabled the the caption bar and double click on captions. Which seems not to allow any docking on to the main form, but If you have several controls that are docked to each other in a Tabbed Style, double clicking on the tab will dock the control to the main form.

Rajesh C [Syncfusion]
Replied On May 18, 2007 01:59 AM UTC

Hi Peter,

You can prevent docking to Main Form when the dock Tab or floating window's caption bar is double clicked . Please refer to the following code snippets which illustrates the same:

[ C# ]


//To prevent docking to Main Form when the floating window's caption bar is double clicked.

this.dockingManager1.EnableDoubleClickOnCaption = false;

// To prevent docking to Main Form when the dock Tab is double clicked.

private void dockingManager1_DragAllow(object sender, DragAllowEventArgs arg)
{
DockHost dhost = arg.Control.Parent as DockHost;
DockHostController dhc = dhost.InternalController as DockHostController;

if (dhc.ParentController is DockTabController)
{
DockTabControl docktab = (dhc.ParentController as DockTabController).TabControl;
foreach (DockTabPage tabpage in docktab.TabPages)
{
if (dockingManager1.IsTabbed(arg.Control))
{
if (!dhost.RectangleToScreen(dhost.TitleBar.CaptionRect).Contains(Cursor.Position) )
{
arg.Cancel = true;
}
}
}
}
}



Please have a look at this sample and let me know if this helps you.

http://websamples.syncfusion.com/samples/Tools.Windows/I34124/Main.htm

Thank you for using Syncfusion products.

Regards,
Rajesh C


Ankur Badola
Replied On July 9, 2007 08:26 AM UTC


Hi, How can I prevent a floatingform (which contains multiple controls docked in) from getting docked to the main form? The DragAllow event does not work in this case.
I am using Syncfusion version 4.2.

Thanks,
Ankur

>Hi Peter,

You can prevent docking to Main Form when the dock Tab or floating window's caption bar is double clicked . Please refer to the following code snippets which illustrates the same:

[ C# ]


//To prevent docking to Main Form when the floating window's caption bar is double clicked.

this.dockingManager1.EnableDoubleClickOnCaption = false;

// To prevent docking to Main Form when the dock Tab is double clicked.

private void dockingManager1_DragAllow(object sender, DragAllowEventArgs arg)
{
DockHost dhost = arg.Control.Parent as DockHost;
DockHostController dhc = dhost.InternalController as DockHostController;

if (dhc.ParentController is DockTabController)
{
DockTabControl docktab = (dhc.ParentController as DockTabController).TabControl;
foreach (DockTabPage tabpage in docktab.TabPages)
{
if (dockingManager1.IsTabbed(arg.Control))
{
if (!dhost.RectangleToScreen(dhost.TitleBar.CaptionRect).Contains(Cursor.Position) )
{
arg.Cancel = true;
}
}
}
}
}



Please have a look at this sample and let me know if this helps you.

http://websamples.syncfusion.com/samples/Tools.Windows/I34124/Main.htm

Thank you for using Syncfusion products.

Regards,
Rajesh C


Jeba S [Syncfusion]
Replied On July 16, 2007 01:27 PM UTC

Hi Ankur,

You can handle the DockingManager.DockAllow event and based on the DockAllowEventArgs parameter, either allow or cancel the event. The DockAllow event will only enable you customize dock/dock-in-float operations. The controls will still be free to float as a unique floating window.


void dockingManager1_DockAllow(object sender, DockAllowEventArgs arg)
{
//Not allow the panel1 to dock in floating mode
if (dockingManager1.IsFloating(this.panel1 ))
{
arg.Cancel = true;
}
}



Please refer the sample in the below link which illustrates the above:
http://websamples.syncfusion.com/samples/Tools.Windows/F61032/main.htm

Thank you for using Syncfusion Products.

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;