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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I prevent a single control from floating state?

Platform: WinForms |
Control: DockingManager |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014


Currently we have a property called DisallowFloating which prevents from floating for all docked controls. There is no method to prevent from floating for a single docked control.

Usually the end user will float a Docked Control by using the DockContextMenu or by dragging that control.So to prevent a control from floating , the best solution is to remove the MenuItem for floating from the DockContextMenu and redock the control to previous dock position if it loses docking.This can be accomplished by the following code in the event handlers for DockContextMenu and DockStateChanged


//This code Will prevent a Panel from floating

private void dockingManager1_DockContextMenu(object sender, Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs arg){

//removes the menu item

if(arg.Owner == panel1)



private void dockingManager1_DockStateChanged(object sender, Syncfusion.Windows.Forms.Tools.DockStateChangeEventArgs arg){

 DockHost dhost = panel1.Parent as DockHost;

DockHostController dhc = dhost.InternalController as DockHostController;

DockInfo di = dhc.DICurrent;

//checking if the control is in floating

if(di.dStyle==DockingStyle.Fill && panel1.Parent.Parent !=null ){

Point p= dhost.PointToScreen(dhost.TitleBar.CaptionRect.Location );

 if(panel1.Parent.Parent is FloatingForm){

  FloatingForm ff=panel1.Parent.Parent as FloatingForm ;

//Performing a double click operation to restore the previous state






' This code Will prevent a Panel from floating

Private Sub dockingManager1_DockContextMenu(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs) Handles dockingManager1.DockContextMenu

'removes the menu item

If arg.Owner Is panel1 Then


End If

End Sub

Private Sub dockingManager1_DockStateChanged(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockStateChangeEventArgs) Handles dockingManager1.DockStateChanged

Dim dhost As DockHost = CType(panel1.Parent, DockHost)

Dim dhc As DockHostController = CType(dhost.InternalController, DockHostController)

Dim di As DockInfo = dhc.DICurrent

'checking if the control is in floating

If di.dStyle = DockingStyle.Fill And Not TypeOf panel1.Parent.Parent Is DBNull Then

Dim p As Point = dhost.PointToScreen(dhost.TitleBar.CaptionRect.Location)

If TypeOf panel1.Parent.Parent Is FloatingForm Then

Dim ff As FloatingForm = CType(panel1.Parent.Parent, FloatingForm)

'Performing a double click operation to restore the previous state


End If

End If

End Sub


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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