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

Is it possible to prevent docking windows from being docked to certain sections of the host form?

 

The DockingManager has two very powerful events - DragAllow and DockAllow - that can be used separately or in tandem to tailor your application’s docking behavior. The DragAllow event is fired just before a drag operation commences while the DockAllow event is generated during the course of a drag operation when the dragged control is moved over a potential dock target. Both events allow for pre-emption and thus drag/dock operations may be deemed as allowed or otherwise based on the event arguments.

Two scenarios for the DockAllow event are shown below

C#

// DockingManager.DockAllow event handler in the Form hosting the DockingManager - Case 1

private void dockingManager1_DockAllow(object sender, Syncfusion.Windows.Forms.Tools.DockAllowEventArgs arg)

{

// Disallow all controls from being docked to the host Form’s left border

if((arg.TargetControl == this) && (arg.DockStyle == Syncfusion.Windows.Forms.Tools.DockingStyle.Left)) arg.Cancel = true;

}

// DockingManager.DockAllow event handler - Case 2

private void dockingManager1_DockAllow(object sender, Syncfusion.Windows.Forms.Tools.DockAllowEventArgs arg)

{

// Disallow the dwNetwork docking window from being docked to the host Form’s left border

if((arg.TargetControl == this) && (arg.DragControl == this.dwNetwork) && (arg.DockStyle == Syncfusion.Windows.Forms.Tools.DockingStyle.Left))

  arg.Cancel = true;

}

VB

' DockingManager.DockAllow event handler in the Form hosting the DockingManager - Case 1

Private Sub dockingManager1_DockAllow(ByVal sender As Object, ByVal arg As

Syncfusion.Windows.Forms.Tools.DockAllowEventArgs) Handles dockingManager1.DockAllow

If (arg.TargetControl Is Me) AndAlso (arg.DockStyle =

Syncfusion.Windows.Forms.Tools.DockingStyle.Left )

Then

arg.Cancel = True

End If

End Sub

'DockingManager.DockAllow event handler - Case 2

Private Sub dockingManager1_DockAllow(ByVal sender As Object, ByVal arg As

Syncfusion.Windows.Forms.Tools.DockAllowEventArgs) Handles dockingManager1.DockAllow

If (arg.TargetControl Is Me) AndAlso (arg.DragControl Is Me.panel1) AndAlso (arg.DockStyle = Syncfusion.Windows.Forms.Tools.DockingStyle.Left)

Then

arg.Cancel = True

End If

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
1028 04/30/2011 07/10/2014 WinForms DockingManager
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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