Docking Events in Windows Forms Docking Manager

The DockingManager provides a functionality for creating and working with enhanced docking windows. This supports attaching to a host form border, dragging and docking to different edges within the form, dragged off the host form, and floated as an individual top-level window. The Docking Framework allows any child control to be made on a form in a fully qualified docking window. The docking manager provides programmatic access to create an interaction between these dockable windows and other complex features such as multiple docking levels, nested docking, tabbed docking, tear-off tabs, auto hide mode, state persistence etc., by raising several events.

The list of events and a detailed explanation about each of them is given in the following sections.

Docking events Description

AutoHideAnimationStart

The AutoHideAnimationStart event occurs just before the start of an auto hide animation.

AutoHideAnimationStop

The AutoHideAnimationStop event occurs immediately after the end of an auto hide animation.

AutoHideTabContextMenu

This event occurs when the right mouse button is clicked over a AutoHideTabControl.

DockMenuClick

This event occurs when the redone context menu item is clicked.

ControlMaximized

This event occurs after the control is maximized.

ControlMaximizing

This event occurs before the control is going to maximize.

ControlMinimized

This event occurs after the control is minimized.

ControlRestored

This event occurs after the control is restored.

DockAllow

The DockAllow event occurs when a docking window is dragged over a potential dock target.

DockContextMenu

The DockContextMenu event occurs when the right mouse button is clicked over a docking window caption.

DockControlActivated

The DockControlActivated event occurs when a dockable control gets activated.

DockControlDeactivated

The DockControlDeactivated event occurs when a dockable control gets deactivated.

DockStateChanged

The DockStateChanged event occurs immediately after a dock operation.

DockStateChanging

The DockStateChanging event occurs just before a dock operation takes place.

DockStateUnavailable

The DockStateUnavailable event occurs if serialized information is not available for a dockable control while loading a persisted dock state.

DockVisibilityChanged

The DockVisibilityChanged event occurs after a control's DockVisibility state is changed.

DockVisibilityChanging

The DockVisibilityChanging event occurs when the DockVisibility state of control is changed.

DragAllow

The DragAllow event occurs when a docking window is dragged.

DragFeedbackStart

The DragFeedbackStart event occurs before starting the feedback of drag operation.

DragFeedbackStop

The DragFeedbackStop event occurs immediately after completing the feedback of drag operation.

ImageListChanged

Occurs when the ImageList property is changed.

InitializeControlOnLoad

The InitializeControlOnLoad event occurs when the docking manager is not able to locate a control during a LoadDockState call.

NewDockStateBeginLoad

The NewDockStateBeginLoad event occurs before loading a new dock state.

NewDockStateEndLoad

The NewDockStateEndLoad event occurs immediately after a new dock state is loaded.

PreviewDockHints

The PreviewDockHints event occurs before displaying the dock hints when drag the windows.

ProvideGraphicsItems

The ProvideGraphicsItems event occurs whenever a dockable control caption needs to be painted.

ProvidePersistenceID

Allows you to specify a unique ID that is used to distinguish the persistence information of different instances of the form type.

TabGroupCreating

The TabGroupCreating event occurs before creating a new document tab group.

TabGroupCreated

The TabGroupCreated event occurs after creating a new document tab group.

TransferredToManager

The TransferredToManager event occurs after a dockable control that belongs to some other docking manager has been transferred to the docking layout hosted by this docking manager.

TransferringFromManager

The TransferringFromManager event occurs when a dockable control hosted by this docking manager is transferred to the docking layout hosted by some other docking manager.

Docking

This section describes the events that are raised while activating and deactivating the docked child window.

DockControlActivated event

The DockControlActivated event occurs when a dockable control gets activated. When the user clicks the dockable control or the docked control, this event will be triggered. It can display the control name which has been activated currently.

Event data

The event handler receives a DockActivationChangedEventArgs argument containing data related to this event. The following DockActivationChangedEventArgs members provide information specific to this event.

Member Description

Control

The control which has been activated now.
//The `DockControlActivated` event will be triggered when a dockable control gets activated.

private void dockingManager1_DockControlActivated(object sender, Syncfusion.Windows.Forms.Tools.DockActivationChangedEventArgs arg)
{

   Console.WriteLine("Dock Control Activated Event is Fired");

   //Here Display the name of the control that is being active currently.

   Console.WriteLine("Activated Control Name : " +arg.Control.Name);

}
'The `DockControlActivated` event will be triggered when a dockable control gets activated.

Private Sub dockingManager1_DockControlActivated(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockActivationChangedEventArgs)

   Console.WriteLine("Dock Control Activated Event is Fired")

   'Here Display the name of the control that is being active currently.

   Console.WriteLine("Activated Control Name : " + arg.Control.Name)

End Sub

DockControlDeactivated event

The DockControlDeactivated event is occurred whenever a dockable control or a docked control loses its focus. In other words, when a dockable control is deactivated, this event will be fired. This event can display the deactivated control name.

Event data

The event handler receives a DockedActivationChangedEventArgs argument containing data related to this event. The following DockActivationChangedEventArgs members provide information specific to this event.

Member Description

Control

The control which has been deactivated now.
//The `DockControlDeactivated` event occurs when a dockable control gets deactivated.

private void dockingManager1_DockControlDeactivated(object sender, Syncfusion.Windows.Forms.Tools.DockActivationChangedEventArgs arg)

{

   //Deactivation Event will be triggered when the control has lost the focus.

   Console.WriteLine("Dock Control Deactivated Event is Fired");

   //Here Display the name of the control that is being active currently.

   Console.WriteLine("Deactivated Control Name : " + arg.Control.Name);

}
'The `DockControlDeactivated` event occurs when a dockable control gets deactivated.

Private Sub dockingManager1_DockControlDeactivated(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockActivationChangedEventArgs)

   'Deactivation Event will be triggered when the control has lost the focus.

   Console.WriteLine("Dock Control Deactivated Event is Fired")

   'Here Display the name of the control that is being active currently.

   Console.WriteLine("Deactivated Control Name : " + arg.Control.Name)

End Sub

DockAllow event

The DockAllow event occurs when a docking window is dragged over a potential dock target. This event helps to cancel the operation that is performed during the docking of windows.

Private void DockingManager1_DockAllow(object sender, DockAllowEventArgs arg)
{
    arg.Cancel = true;
}
Private Sub DockingManager1_DockAllow(ByVal sender As Object, ByVal arg As DockAllowEventArgs)

   arg.Cancel = True

End Sub

Notify auto hide

This section describes events that are raised at starting and ending of auto hide animation.

AutoHideAnimationStart event

The AutoHideAnimationStart event occurs before starting an auto hide animation. When users try to click the auto hide button to hide the docked control, this event will be triggered.

Event data

The AutoHideAnimationEventHandler receives an argument of AutoHideAnimationEventArgs type containing data related to this event. The following AutoHideAnimationEventArgs members provide information specific to this event.

Members Description

Bounds

Displays the bounds of the auto hidden control.

DockBorder

Provides HostForm border along which the AutoHide tab is aligned.
private void dockingManager1_AutoHideAnimationStart(object sender, Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs arg)

{

   // You can see the below line in output window during runtime.

   Console.WriteLine("Auto Hide Animation starting now : " +i++);

   //AutoHideAnimationEvent argument Contains the property "Control".

   //It has all kind of functions, events and properties of Control Class.

   Console.WriteLine("Control Name : " +arg.Control.Name);

   //The display bounds of the AutoHidden control. It will return the object of Rectangle Class

   Console.WriteLine("Control Bounds Value : " +arg.Bounds.ToString());

   //The HostForm border along which the AutoHide tab is aligned.

   Console.WriteLine("Control Dock Border Value : "+arg.DockBorder.ToString() + "Type of the Dock Border is : " +arg.DockBorder.GetType());

}
Private Sub dockingManager1_AutoHideAnimationStart(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("Auto Hide Animation starting now : "+ i++)

   'AutoHideAnimationEvent argument Contains the property "Control".

   'It has all kind of functions, events and properties of Control Class.

   Console.WriteLine("Control Name : "+arg.Control.Name)

   'The display bounds of the AutoHidden control. It will return the object of Rectangle Class

   Console.WriteLine("Control Bounds Value : "+arg.Bounds.ToString())

   'The HostForm border along which the AutoHide tab is aligned.

   Console.WriteLine("Control Dock Border Value : "+arg.DockBorder.ToString() + "Type of the Dock Border is : " +arg.DockBorder.GetType())

End Sub

AutoHideAnimationStop event

The AutoHideAnimationStop event occurs immediately after the auto hide animation ends. When users click the auto hide button, the docked control will be hidden and this event will be triggered.

Event data

The AutoHideAnimationEventHandler receives an [AutoHideAnimationEventArgs] (https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs.html) argument containing data related to this event. The following AutoHideAnimationEventArgs members provide information specific to this event.

Members Description

Bounds

Displays the bounds of the auto hidden control.

DockBorder

Provides HostForm border along which the AutoHide tab is aligned.
//The `AutoHideAnimationStop` event occurs immediately after the end of an AutoHide animation.

private void dockingManager1_AutoHideAnimationStop(object sender, Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs arg)

{

   Console.WriteLine("Animation has been stopped");

   //AutoHideAnimationEvent argument Contains the property "Control".

   //It has all kind of functions, events and properties of Control Class.

   Console.WriteLine("Control Name : "+arg.Control.Name);

   //The display bounds of the AutoHidden control. It will return the object of Rectangle Class

   Console.WriteLine("Control Bounds Value : "+arg.Bounds.ToString());

   //The HostForm border along which the AutoHide tab is aligned.

   Console.WriteLine("Control Dock Border Value : "+arg.DockBorder.ToString() + "Type of the Dock Border is : " +arg.DockBorder.GetType());

}
'The `AutoHideAnimationStop` event occurs immediately after the end of an AutoHide animation.

Private Sub dockingManager1_AutoHideAnimationStop(ByVal sender As object, ByVal arg As Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs )

   Console.WriteLine("Animation has been stopped")

   'AutoHideAnimationEvent argument Contains the property "Control".

   'It has all kind of functions, events and properties of Control Class.

   Console.WriteLine("Control Name : "+arg.Control.Name)

   'The display bounds of the AutoHidden control. It will return the object of Rectangle Class

   Console.WriteLine("Control Bounds Value : "+arg.Bounds.ToString())

  'The HostForm border along which the AutoHide tab is aligned.

   Console.WriteLine("Control Dock Border Value : "+arg.DockBorder.ToString() + "Type of the Dock Border is : " +arg.DockBorder.GetType())

End Sub

Caption double-click

The OnCaptionDoubleClick event occurs when you double-click a dockable control or a docked control caption. This event is triggered when the EnableDoubleClickOnCaption property is set to false. It displays the currently active control name.

Event data

The event handler receives a DockControlMouseSelection argument that contains data related to this event. The following DockControlMouseSelection members provide information specific to this event.

Member Description

Control

Gets the control that is activated.
private void dockingManager1_OnCaptionDoubleClick(object sender, Syncfusion.Windows.Forms.Tools.DockControlMouseSelection arg)
{
   // OnCaptionDoubleClick event is triggered

   Console.WriteLine("Dock Control Activated Event is Fired");

   //Displays the name of the control that is currently active.

   Console.WriteLine("Activated Control Name : "+arg.Control.Name);

}
'The DockControlActivated event occurs when a dockable control gets activated.

Private Sub dockingManager1_OnCaptionDoubleClick(ByVal sender As Object, ByVal arg AsSyncfusion.Windows.Forms.Tools.DockActivationChangedEventArgs)

   'OnCaptionDoubleClick event is triggered

   Console.WriteLine("Dock Control Activated Event is Fired");

   'Displays the name of the control that is currently active.

   Console.WriteLine("Activated Control Name : "+arg.Control.Name);

End Sub

Context menu

This section discusses the following events that are related to the ContextMenu:

AutoHideTabContextMenu event

The AutoHideTabContextMenu event will be triggered when users click the right mouse button over an auto hidden tab control. The AutoHide window ContextMenu can be enabled or disabled by using the EnableAutoHideTabContextMenu property. Its default value is true.

Event data

The event handler receives an AutoHideTabContextMenuEventArgs argument containing data related to this event. The following AutoHideTabContextMenuEventArgs members provide information specific to this event.

Members Description

ContextMenu

Gets/sets the context menu to be displayed.

Side

Returns the side at which the AutoHideTab is aligned.
private void dockingManager1_AutoHideTabContextMenu(object sender, Syncfusion.Windows.Forms.Tools.AutoHideTabContextMenuEventArgs arg)
{

   // You can see the below line in output window during runtime.

   Console.WriteLine("AutoHideTabContextMenu event is raised");

}
Private Sub dockingManager1_AutoHideTabContextMenu(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.AutoHideTabContextMenuEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("AutoHideTabContextMenu event is raised")

End Sub

DockContextMenu event

The DockContextMenu event gets fired when the mouse is right-clicked over a docking window caption.

Event data

The event handler has an argument of DockContextMenuEventArgs type. That argument has two properties such as ContextMenu of PopupMenu type and Owner of control type. The ContextMenu gives access to the menu that is to be displayed and owner identifies the docked control. So, by checking the owner object, you can remove the context menu for a particular control.

The DockContextMenuEventArgs allows us to,

Create a simple docking window. Add the required namespaces. Declare and initialize the bar items to be placed in the context menu as shown in the following code.

//Adding namespaces

using Syncfusion.Windows.Forms.Tools.XPMenus;

//Declaring the bar items

private Syncfusion.Windows.Forms.Tools.XPMenus.BarItem bar1;

private Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem fileItem;

//Initialize and set the properties.

this.fileItem = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem();

this.bar1 = new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem();

this.fileItem.Text = "File";

this.bar1.Text = "Exit";

this.fileItem.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] {this.bar1});

//Call the event

this.dockingManager1.DockContextMenu += new Syncfusion.Windows.Forms.Tools.DockContextMenuEventHandler(this.dockingManager1_DockContextMenu);

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

{

   arg.ContextMenu.ParentBarItem.Items.Add(this.fileItem);

}
' Adding Namespace

Imports Syncfusion.Windows.Forms.Tools.XPMenus

'Declaration

Private fileItem As Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem

Private WithEvents bar1 As Syncfusion.Windows.Forms.Tools.XPMenus.BarItem

'Initialize and set the properties

Me.fileItem = New Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem()

Me.bar1 = New Syncfusion.Windows.Forms.Tools.XPMenus.BarItem()

Me.fileItem.Text = "File"

Me.bar1.Text = "Exit"

Me.fileItem.Items.AddRange(New Syncfusion.Windows.Forms.Tools.XPMenus.BarItem() { Me.bar1})

//handling the event

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

   arg.ContextMenu.ParentBarItem.Items.Add(Me.fileItem)

End Sub

Dock window context menu item

DockMenuClick event

DockMenuClick event gets fired, when the re-dock context menu item has been clicked. The menu button of docked controls provide options to change the docking position. Whenever users try to re-dock the control to some other position, the DockMenuClick event will be triggered. The provided options are left, top, right, and bottom. These re-dock context menu item option is available only in VS2008 Docking Style. The re-dock style can be displayed using the below code.

Event data

The DockMenuClickEventHandler receives a DockMenuClickEventArgs argument containing data related to this event. The following DockMenuClickEventArgs members provide information specific to this event.

Members Description

DockingStyle

Returns the docking of the window.
private void dockingManager1_DocMenuClick(object sender, Syncfusion.Windows.Forms.Tools.DockMenuClickEventArgs arg)
{

   // You can see the below line in output window during runtime.

   Console.WriteLine("Dock Menu Click event is raised");

   //Display the Docking Style

   Console.WriteLine("DockingStyle : " + arg.DockingStyle.ToString());

}
Private Sub dockingManager1_DocMenuClick(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockMenuClickEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("Dock Menu click event is raised")

   'Display the Docking Style

   Console.WriteLine("DockingStyle : " + arg.DockingStyle.ToString());

End Sub

Notify maximize dock control

ControlMaximizing and ControlMaximized events of docking manager get triggered while maximizing the docked control.

ControlMaximizing event

The ControlMaximizing event will be raised, when users click the maximize button in the docked controls or when the control will be maximized.

Event data

The event handler receives an argument of ControlMaximizeEventArgs type containing data related to this event. The following ControlMaximizeEventArgs members provide information specific to this event.

Members Description

Cancel

Gets/sets value that indicates whether to cancel the operation or not.
private void dockingManager1_ControlMaximizing(object sender, Syncfusion.Windows.Forms.Tools.ControlMaximizeEventArgs arg)
{

   // You can see the below line in output window during runtime.

   Console.WriteLine("Control Maximizing event is raised");

   //Displays the docked control name

   Console.WriteLine("Control Name : "+arg.Control.Name);

   //Cancel is the boolean property which can prevent docking event when it is true.

   arg.Cancel = true;

}
Private Sub dockingManager1_ControlMaximizing(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.ControlMaximizeEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("Control Maximizing event is raised")

   'Displays the docked control name

   Console.WriteLine("Control Name : "+arg.Control.Name)

   'Cancel is the boolean property which can prevent docking event when it is true.

   arg.Cancel = True

End Sub

ControlMaximized event

The docked control gets maximized, when the maximized button of the docked control is clicked. The ControlMaximized event will be triggered after the control is maximized.

Event data

The event handler receives an argument of ControlMaximizedEventArgs type containing data related to this event.

private void dockingManager1_ControlMaximized(object sender, Syncfusion.Windows.Forms.Tools.ControlMaximizedEventArgs arg)

{

   // You can see the below line in output window during runtime.

   Console.WriteLine("Control Maximized event is raised");

   //Displays the docked control name

   Console.WriteLine("Control Name : "+arg.Control.Name);

   //Cancel is the Boolean property which can prevent docking event when it is true.

   arg.Cancel=true;

}
Private Sub dockingManager1_ControlMaximized(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.ControlMaximizedEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("Control Maximized event is raised")

   'Displays the docked control name

   Console.WriteLine("Control Name : "+arg.Control.Name)

   'Cancel is the Boolean property which can prevent docking event when it is true.

   arg.Cancel=True

End Sub

Notify restore

The ControlRestored event gets fired after the docked control is restored to its original position. This event can give the previous state of the control using the PreviousSizeState property of the handler.

Event data

The event handler receives an argument of ControlRestoredEventArgs type containing data related to this event. The following ControlRestoredEventArgs members provide information specific to this event.

Member Description

PreviousSizeState

Returns previous size state of changing control.
private void dockingManager1_ControlRestored(object sender, ControlRestoredEventArgs arg)
{

   // You can see the below line in output window during runtime.

   Console.WriteLine("Control Restored event is raised");

   //Displays the previous state
 
   Console.WriteLine("Control Name : "+arg.PreviousSizeState.ToString());
}
Private Sub dockingManager1_ControlRestored(ByVal sender As Object, ByVal arg As ControlRestoredEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("Control Restored event is raised")

   'Displays the previous state

   Console.WriteLine("Control Name : "+arg.PreviousSizeState.ToString());

End Sub

Notify minimize dock control

The ControlMinimized event is fired after the control is minimized using the minimize option of the docked control. This event can display the control name using the control parameter in the ControlMinimizedEventArgs(https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.Tools.ControlMinimizedEventArgs.html).

Members Description

Control

Specifies the minimized docked control.
private void dockingManager1_ControlMinimized(object sender, ControlMinimizedEventArgs arg)
{

   // You can see the below line in output window during runtime.

   Console.WriteLine("Control Minimized event is raised");

   // Displays the docked control name

   Console.WriteLine("Control Name : "+arg.Control.Name);

}
Private Sub dockingManager1_ControlMinimized(ByVal sender As Object, ByVal arg As ControlMinimizedEventArgs)

   ' You can see the below line in output window during runtime.

   Console.WriteLine("Control Minimized event is raised")

   'Displays the docked control name

   Console.WriteLine("Control Name : "+arg.Control.Name);

End Sub

Notify dock state change

This section covers the following events:

DockStateChanged event

The DockStateChanged event will be raised immediately when the user changes the dock state of the control.

Event data

The event handler receives an argument of DockStateChangeEventArgs type containing data related to this event. The following DockStateChangeEventArgs members provide information specific to this event.

Member Description

Controls

Get the collection of controls undergoing the dock state transfer.
//The `DockStateChanged` event occurs immediately after a dock operation.

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

{

   Console.WriteLine("DockStateChanged Event has occurred");

   Console.WriteLine("Total Number of controls in a group : " + arg.Controls.Length.ToString());

   //arg.Controls Gets the collection of controls undergoing the dock state transfer.

   Control[] controls = arg.Controls;

   int i=1;

   //Here display all the controls in arg.Controls group.

   foreach(Control ctrl in controls)

   {

     Console.WriteLine("Control"+ i + " Name : " + ctrl.Name);

     i++;

   }

}
'The `DockStateChanged` event occurs immediately after a dock operation.

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

   Console.WriteLine("DockStateChanged Event has occurred")

   Console.WriteLine("Total Number of controls in a group : " + arg.Controls.Length.ToString)

   'arg.Controls Gets the collection of controls undergoing the dock state transfer.

   Dim controls As Control() = arg.Controls

   Dim i As Integer = 1

   'Here display all the controls in arg.Controls group.

   For Each ctrl As Control In controls

     Console.WriteLine("Control" + i + " Name : " + ctrl.Name)

     System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)

   Next

End Sub

DockStateChanging event

The DockStateChanging event will be triggered before changing the dock state of the particular control.

Event data

The event handler receives an argument of DockStateChangeEventArgs type containing data related to this event. The following DockStateChangeEventArgs members provides information specific to this event.

Member Description

Controls

Get the collection of controls undergoing the dock state transfer.

NewState

Gets or sets a value that indicates the new state of dock child.

OldState

Gets a value that indicates the old state of dock child.

Handled

Gets or sets a value that decides whether to handle the dock state changes in DockingManager.
//The DockStateChanging event occurs just before a dock operation takes place.

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

{
   Console.WriteLine("DockStateChanging Event has occurred");
   
   Console.WriteLine("Total Number of controls in a group : "+arg.Controls.Length.ToString());

   //arg.Controls gives the collection of controls which are in Docked Area.

   Control[] controls = arg.Controls;

   int i=1;

   //Here display all the controls in arg.Controls group.

   foreach(Control ctrl in controls)
   {

     Console.WriteLine("Control"+ i + " Name : " + ctrl.Name);

     i++;

   }

   //handle the dock state changing for Panel1
    
   if (this.panel1 == ctrl)
   {
      arg.Handled = true;
   }
   else
   {
      arg.Handled = false;
   }
            
   // arg.OldState indicates the old state of dock child.
   Console.WriteLine("Old DockState:"+ arg.OldState.ToString());

   // arg.NewValue indicates the new state of dock child.
   Console.WriteLine("New DockState:" +arg.NewState.ToString());


}
'The DockStateChanging event occurs just before a dock operation takes place.

Private Sub dockingManager1_DockStateChanging(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockStateChangeEventArgs)

   Console.WriteLine("DockStateChanging Event has occurred")

   Console.WriteLine("Total Number of controls in a group : " + arg.Controls.Length.ToString)

   'arg.Controls gives the collection of controls which are in Docked Area.

   Dim controls As Control() = arg.Controls

   Dim i As Integer = 1

   'Here display all the controls in arg.Controls group.

   For Each ctrl As Control In controls

     Console.WriteLine("Control" + i + " Name : " + ctrl.Name)

     System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)

   Next

   'handle the dock state changing for Panel1
    
   If Me.panel1 Is ctrl Then
      arg.Handled = Truetrue;
   }
   Else
		arg.Handled = False
	End If
   Next ctrl

            
   'arg.OldState indicates the old state of dock child
   Console.WriteLine("Old DockState:" & arg.OldState.ToString())

   'arg.NewValue indicates the new state of dock child.
   Console.WriteLine("New DockState:" & arg.NewState.ToString())

End Sub

DockStateUnavailable event

The DockStateUnavailable event will be triggered if serialized information is not available for a dockable control while loading a persisted dock state.

Event data

The event handler receives an argument of DockStateUnavailableEventArgs type containing data related to this event. The following DockStateUnavailableEventArgs members provide information specific to this event.

Member Description

Control

Gets the name of the control.
//The `DockStateUnavailable` event occurs if serialized information is not available for a dockable control when loading a persisted dock state.

private void dockingManager1_DockStateUnavailable(object sender, Syncfusion.Windows.Forms.Tools.DockStateUnavailableEventArgs arg)

{

   Console.WriteLine("DockStateUnavailable Event has been fired");

   Console.WriteLine("Dock state unavailable for the Control is :" +arg.Control.Name);

}
'The `DockStateUnavailable` event occurs if serialized information is not available for a dockable control when loading a persisted dock state.

Private Sub dockingManager1_DockStateUnavailable(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockStateUnavailableEventArgs)

   Console.WriteLine("DockStateUnavailable Event has been fired")

   Console.WriteLine("Dock state unavailable for the Control is : " + arg.Control.Name)

End Sub

NewDockStateBeginLoad event

The NewDockStateBeginLoad event occurs before loading a new dock state of the particular control. Whenever an application with one or more docked controls is going to be loaded, this event will be triggered.

//The NewDockStateBeginLoad event occurs just before a new dock state is loaded.

private void dockingManager1_NewDockStateBeginLoad(object sender, System.EventArgs e)

{

   Console.WriteLine("NewDockStateBeginLoad Event occurred");

   //This will show until you click on the OK button.

   //So The new state will be loaded after finishing this statement.

   MessageBox.Show("This is NewDockStateBeginLoad Event Message Box");

}
Private Sub dockingManager1_NewDockStateBeginLoad(ByVal sender As Object, ByVal e As System.EventArgs)

   Console.WriteLine("NewDockStateBeginLoad Event occurred")

   'This will show until you click on the OK button.

   'So The new state will be loaded after finishing this statement.

   MessageBox.Show("This is NewDockStateBeginLoad Event Message Box")

End Sub

NewDockStateEndLoad event

The NewDockStateEndLoad event occurs immediately after a new dock state has been loaded. Whenever an application with one or more docked controls is loaded, this event will be triggered.

//The `NewDockStateEndLoad` event occurs immediately after a new dock state has been loaded.

private void dockingManager1_NewDockStateEndLoad(object sender, System.EventArgs e)

{

   Console.WriteLine("NewDockStateEndLoad Event occurred");

   //This will show until you click on the OK button.

   //So The new state will be loaded after finishing this statement.

   MessageBox.Show("This is NewDockStateEndLoad Event Message Box");

}
'The `NewDockStateEndLoad` event occurs immediately after a new dock state has been loaded.

Private Sub dockingManager1_NewDockStateEndLoad(ByVal sender As Object, ByVal e As System.EventArgs)

   Console.WriteLine("NewDockStateEndLoad Event occurred")

   'This will show until you click on the OK button.

   'So The new state will be loaded after finishing this statement.

   MessageBox.Show("This is NewDockStateEndLoad Event Message Box")

End Sub

Change docking side of the dragged window using event

You can restrict the docking sides of the dragged window by handling the PreviewDockHints event and setting the dockable sides to the DockAbility property . You can also allow the particular target window to restrict it’s sides to dock the dragged window. This event invoked before displaying the dock hints when drag the windows.

The PreviewDockHintsEventArgs provides the following event data for the PreviewDockHints event in DockingManager.

  • DockAbility : Gets or sets the dockability to decide the visibility of dock hints on mouse hover the target window.

  • DraggingSource : Gets or sets the dragging element of DockingManager that raises the PreviewDockHints event.

  • DraggingTarget : Gets or sets the target element in which the dragging window of DockingManager to be docked.

  • IsOuterDockHints : Gets values that specify PreviewDockHints occurred for inner dockability or outer dockability of dragging child in DockingManager.

this.dockingManager1.PreviewDockHints += DockingManager1_PreviewDockHints;

private void DockingManager1_PreviewDockHints(object sender, PreviewDockHintsEventArgs e) {
   if(e.DraggingTarget == panel2) {
      //Sets the panel 2 to show right dock hint for other windows to dock on right side only.
      e.DockAbility = Syncfusion.Windows.Forms.Tools.DockAbility.Right;
   }
}
Private Sub DockingManager1_PreviewDockHints(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.PreviewDockHintsEventArgs)
    If e.DraggingTarget = panel2 Then
        e.DockAbility = Syncfusion.Windows.Forms.Tools.DockAbility.Right
    End If
End Sub

PreviewDockHints

View sample in GitHub

TabGroupCreating event

The TabGroupCreating event occurs before creating a new document tab group. The TabGroupCreatingEventArgs provides the following event data for the TabGroupCreating event of docking manager.

  • TargetItem : Gets the target item which added as new document tab group.

  • Orientation : Gets the orientation of newly created document tab group.

  • Cancel : Cancels the tab group creation. You can restrict creation of document tab group based on orientation or target item.

private void DockingManager1_TabGroupCreating(object sender, TabGroupCreatingEventArgs arg)
{
  //To cancel the tab group creation for Horizontal orientation
   if(arg.Orientation == Orientation.Horizontal)
            {
                arg.Cancel = true;
            }
}
Private Sub DockingManager1_TabGroupCreating1(ByVal sender As Object, ByVal arg As TabGroupCreatingEventArgs)
			'To cancel the tab group creation for Horizontal orientation
			If arg.Orientation = Orientation.Horizontal Then
				arg.Cancel = True
			End If
		End Sub

TabGroupCreated event

The TabGroupCreated event occurs after creating a new document tab group. The TabGroupCreatedEventArgs provides the following event data for the TabGroupCreated event of docking manager. You can customize the appearance and behavior of document tab groups using the tab group instance provided by the TabGroupCreated event.

  • CurrentTabGroup : Gets the current document tab group of tab item that triggers tab group creation.

  • PreviousTabGroup : Gets the previous document tab group of tab item that triggers tab group creation.

  • TabGroups : Gets the collections of document tab groups in docking manager.

  • TargetItem : Gets the target item added as a new document tab group.

  • Orientation : Gets the orientation of newly created document tab group.

private void DockingManager1_TabGroupCreated(object sender, Syncfusion.Windows.Forms.Tools.TabGroupCreatedEventArgs arg)
        {
          foreach(TabHost tab in arg.TabGroups)
            {
                if (tab.MDITabPanel == arg.CurrentTabGroup)
                {
                  // Customize  background of the active tab item of current tab group
                    arg.CurrentTabGroup.ActiveTabColor = Color.Purple;
                }

                if(tab.MDITabPanel == arg.PreviousTabGroup)
                {
                   // Customize  background of the active tab item of previous tab group
                    arg.PreviousTabGroup.ActiveTabColor = Color.Green;
                }
            }
        }
Private Sub DockingManager1_TabGroupCreated(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.TabGroupCreatedEventArgs)
		  For Each tab As TabHost In arg.TabGroups
				If tab.MDITabPanel Is arg.CurrentTabGroup Then

        'Customize  background of the active tab item of current tab group
					arg.CurrentTabGroup.ActiveTabColor = Color.Purple
				End If

				If tab.MDITabPanel Is arg.PreviousTabGroup Then

        'Customize  background of the active tab item of previous tab group
					arg.PreviousTabGroup.ActiveTabColor = Color.Green
				End If
		  Next tab
		End Sub

Tab group customization

Dock visibility

This section covers the following events:

DockVisibilityChanged event

This event occurs after the DockVisibility state of a control has been changed. When users click the close button, the control visibility changes, and the DockVisibilityChanged event will be handled. You can also use the DockingManager.GetDockVisibility function to learn the current status of the docking window.

Event data

The event handler receives an argument of DockVisibilityChangedEventArgs type containing data related to this event. The following DockVisibilityChangedEventArgs members provide information specific to this event.

Member Description

Control

Gets the control undergoing the visibility change.
//this event triggers when the control's visibility has changed. 

private void dockingManager1_DockVisibilityChanged(object sender, Syncfusion.Windows.Forms.Tools.DockVisibilityChangedEventArgs arg)

{

   //GetDockVisibility function gives the detail of the docked control visibility 

   if (this.dockingManager1.GetDockVisibility(arg.Control) == false)

   {

        //DockVisibilityChangedEventArgs instance arg holds the control being changed the visibility  

        MessageBox.Show(this.dockingManager1.GetDockLabel(arg.Control) + " " + " window is closed.");
   }

}
'this event triggers when the control's visibility has changed. 

 Private Sub dockingManager1_DockVisibilityChanged(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockVisibilityChangedEventArgs) Handles  

  dockingManager1.DockVisibilityChanged()

 'GetDockVisibility function gives the detail of the docked control visibility 

  If Me.dockingManager1.GetDockVisibility(arg.Control) = False Then

      'DockVisibilityChangedEventArgs instance arg holds the control being changed the visibility  

      MessageBox.Show(Me.dockingManager1.GetDockLabel(arg.Control) + " " + " window is closed.")

  End If

 End Sub

DockVisibilityChanging event

This event gets fired while changing the visibility of particular docked control. To avoid changing the visibility of control, cancel this event operation which gets executed.

private void DockingManager1_DockVisibilityChanging(object sender, DockVisibilityChangingEventArgs arg)
{
   arg.Cancel = true;
}
Private Sub DockingManager1_DockVisibilityChanging(ByVal sender As Object, ByVal arg As DockVisibilityChangingEventArgs)

   arg.Cancel=True

End Sub

Drag events

This section covers the events which occurs while performing the dragging operation:

DragAllow event

The DragAllow event is triggered when a docking window is dragged. If users want to dock a control, drag the control to dock it to a particular target. This event will be triggered, when the dragging process starts.

Event data

The DragAllowEventHandler receives an argument of DragAllowEventArgs type containing data related to this event. The following DragAllowEventArgs members provides information specific to this event.

Members Description

Cancel

This property gets/sets the value indicating whether the event should be canceled.

Control

Drags the control.
//The `DragAllow` event occurs when a docking window is dragged.

private void dockingManager1_DragAllow(object sender, Syncfusion.Windows.Forms.Tools.DragAllowEventArgs arg)
{

   Console.WriteLine("DragAllow Event has been triggered");

   //arg.Control property gives the reference to be dragged.

   if(arg.Control==this.panel1)

   {

     //arg.Cancel is the property used to cancel the drag operation when it's in true state.

     arg.Cancel=true;

   }

}
'The `DragAllow` event occurs when a docking window is dragged.

Private Sub dockingManager1_DragAllow(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DragAllowEventArgs)

   Console.WriteLine("DragAllow Event has been triggered")

   'arg.Control property gives the reference to be dragged.

   If arg.Control = Me.panel1 Then

   'arg.Cancel is the property used to cancel the drag operation when it's in true state.

   arg.Cancel = True

End If

End Sub

DragFeedbackStart event

The DragFeedbackStart event is fired before starting the feedback of a drag operation. When the docked control is dragged from its current position to another position, this event will be raised. You can restrict invoking this event by using the DragFeedbackEventsOnSplitters property. The default value is true.

//The `DragFeedbackStart` event occurs just before the start of feedback of a drag operation.

private void dockingManager1_DragFeedbackStart(object sender, System.EventArgs e)
{

   Console.WriteLine("DragFeedbackStart Event has been ");

   //The following code is used to display all control names which are in the DockingManager.

   Syncfusion.Windows.Forms.Tools.DockingManager ctrl=sender as

   Syncfusion.Windows.Forms.Tools.DockingManager;

   IEnumerator enumerator = ctrl.Controls;

   ArrayList dockedControls = new ArrayList();

   while(enumerator.MoveNext())

   dockedControls.Add(enumerator.Current);

   foreach(Control c in dockedControls)

   {

     Console.WriteLine("Control Name :" + c.Name);

   }

}
'The `DragFeedbackStart` event occurs just before the start of feedback of a drag operation.

Private Sub dockingManager1_DragFeedbackStart(ByVal sender As Object, ByVal e As System.EventArgs)

   Console.WriteLine("DragFeedbackStart Event has been ")

   Dim ctrl As Syncfusion.Windows.Forms.Tools.DockingManager = CType(ConversionHelpers.AsWorkaround(sender, GetType(Syncfusion.Windows.Forms.Tools.DockingManager)), Syncfusion.Windows.Forms.Tools.DockingManager)

   Dim enumerator As IEnumerator = ctrl.Controls

   Dim dockedControls As ArrayList = New ArrayList

   While enumerator.MoveNext

   dockedControls.Add(enumerator.Current)

   End While

   For Each c As Control In dockedControls

    Console.WriteLine("Control Name :" + c.Name)

   Next

End Sub

DragFeedbackStop event

The DragFeedbackStop event occurs immediately after the end of the feedback of a drag operation. When the docked control is dragged from its position to another position, this event will be raised. Whenever the mouse click is released from dragging, the drag feedback will be stopped and the DragFeedbackStop event will be triggered. You can restrict invoking this event by using the DragFeedbackEventsOnSplitters property. The default value of this property is true.

//The DragFeedbackStop event occurs immediately after the end of feedback of a drag operation.

private void dockingManager1_DragFeedbackStop(object sender, System.EventArgs e)
{

   Console.WriteLine("DragFeedbackStop Event is raised");
}
'The DragFeedbackStop event occurs immediately after the end of feedback of a drag operation.

Private Sub dockingManager1_DragFeedbackStop(ByVal sender As Object, ByVal e As System.EventArgs)

   Console.WriteLine("DragFeedbackStop Event is raised")

End Sub

Linked managers

This section discusses the following LinkedManager events:

TransferredToManager event

The TransferredToManager event occurs when the dockable control that previously belonged to some other docking manager has been transferred to the docking layout hosted by the current docking manager.

Event data

The event handler receives an argument of [TransferManagerEventArgs] (https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.Tools.TransferManagerEventArgs.html) type containing data related to this event. The following TransferManagerEventArgs members provide information specific to this event.

Member Description

Control

Gets the control that is undergoing the transfer process.
// A docking window is being transferred from one docking layout to another.

// Update the control's DockingManager reference.

protected void DockingManager_TransferredToManager(object sender, TransferManagerEventArgs args)

{

   Console.WriteLine("Transferred to Manager Event has been Raised");

   DockableControlBase dockableControl = args.Control as DockableControlBase;

   dockableControl.CurrentDockingManager = sender as DockingManager;

   Console.WriteLine("HostControl Name (Target Page Name) : "+dockableControl.CurrentDockingManager.HostControl.Name);

}
Protected Sub DockingManager_TransferredToManager(ByVal sender As Object, ByVal args As TransferManagerEventArgs)

   Console.WriteLine("Transferred to Manager Event has been Raised")

   Dim dockableControl As DockableControlBase = CType(ConversionHelpers.AsWorkaround(args.Control, GetType(DockableControlBase)), DockableControlBase)

   dockableControl.CurrentDockingManager = CType(ConversionHelpers.AsWorkaround(sender, GetType(DockingManager)), DockingManager)

   Console.WriteLine("HostControl Name (Target Page Name) : " + dockableControl.CurrentDockingManager.HostControl.Name)

End Sub

TransferringFromManager event

The TransferringFromManager event will be raised when a dockable control hosted by the docking manager is transferred to the docking layout hosted by some other docking manager.

Event data

The event handler receives an argument of TransferManagerEventArgs type containing data related to this event. The following TransferManagerEventArgs members provide information specific to this event.

Member Description

Control

Gets the control that is undergoing the transfer process.
//The TransferringFromManager event occurs when a dockable control hosted by this DockingManager is transferred to the docking layout hosted by some other DockingManager.

protected void DockingManager_TransferringFromManager(object sender, TransferManagerEventArgs args)

{

   Console.WriteLine("Transferring From Manager Event has been raised");

   DockableControlBase dockableControl = args.Control as DockableControlBase;

   dockableControl.CurrentDockingManager = sender as DockingManager; 

   Console.WriteLine("HostControl name : "+dockableControl.CurrentDockingManager.HostControl.Name);

}
'The `TransferringFromManager` event occurs when a dockable control hosted by this DockingManager is transferred to the docking layout hosted by some other DockingManager.

Protected Sub DockingManager_TransferringFromManager(ByVal sender As Object, ByVal args As TransferManagerEventArgs)

   Console.WriteLine("Transferring From Manager Event has been raised")

   Dim dockableControl As DockableControlBase = CType(ConversionHelpers.AsWorkaround(args.Control, GetType(DockableControlBase)), DockableControlBase)

   dockableControl.CurrentDockingManager = CType(ConversionHelpers.AsWorkaround(sender, GetType(DockingManager)), DockingManager)

   Console.WriteLine("HostControl name : " + dockableControl.CurrentDockingManager.HostControl.Name)

End Sub

InitializeControlOnLoad event

The InitializeControlOnLoad event occurs when the docking manager is not able to locate a control during the LoadDockState call.

Event data

The event handler receives an argument of InitializeControlOnLoadEventArgs type containing data related to this event. The following InitializeControlOnLoadEventArgs members provides information specific to this event.

Member Description

ControlName

Provides name property of the control.
protected void DockingManager_InitializeControlOnLoad(object sender, InitializeControlOnLoadEventArgs args)
{

   Console.WriteLine("InitializeControlOnLoad Event is Raised for the Control : " +args.ControlName);

   DockingManager dockingManager = sender as DockingManager;

   switch (args.ControlName)

   {

     case "Suite Logo":

     this.ActivateSuiteLogoControl(dockingManager, false);

     break;

     case "Suite Info":

     this.ActivateSuiteInfoControl(dockingManager, false);

     break;

     case "Tools Info":

     this.ActivateToolsInfoControl(dockingManager, false);

     break;

     case "Tools Logo":

     this.ActivateToolsLogoControl(dockingManager, false);

     break;
  
     case "Grid Logo":

     this.ActivateGridLogoControl(dockingManager, false);

     break;

     case "Grid Info":

     this.ActivateGridInfoControl(dockingManager, false);

     break;

   }

}
Protected Sub DockingManager_InitializeControlOnLoad(ByVal sender As Object, ByVal args As InitializeControlOnLoadEventArgs)

   Console.WriteLine("InitializeControlOnLoad Event is Raised for the Control : " + args.ControlName)

   Dim dockingManager As DockingManager = CType(ConversionHelpers.AsWorkaround(sender, GetType(DockingManager)), DockingManager)

   Select Case args.ControlName

    Case "Suite Logo"

    Me.ActivateSuiteLogoControl(dockingManager, False)

    ' break 

    Case "Suite Info"

    Me.ActivateSuiteInfoControl(dockingManager, False)

    ' break 

    Case "Tools Info"

    Me.ActivateToolsInfoControl(dockingManager, False)

    ' break 

    Case "Tools Logo"

    Me.ActivateToolsLogoControl(dockingManager, False)

    ' break 

    Case "Grid Logo"

    Me.ActivateGridLogoControl(dockingManager, False)

    ' break 

    Case "Grid Info"

    Me.ActivateGridInfoControl(dockingManager, False)

    ' break 

   End Select

End Sub

ImageListChanged event

When the image list property is changed, the ImageListChanged event will be raised. Every docked control has SetDockIcon property to set icons for the control. When this property is changed, the above event will be triggered.

//Occurs when the `ImageList` property changes

private void dockingManager1_ImageListChanged(object sender, System.EventArgs e)

{

   Console.WriteLine("ImageList Changed Event Is Triggered");

   //Here the code which set the Docking Icon dynamically.

   dockingManager1.SetDockIcon(this.panel1,0);

   dockingManager1.SetDockIcon(this.panel2,1);

}
'Occurs when the `ImageList` property changes

Private Sub dockingManager1_ImageListChanged(ByVal sender As Object, ByVal e As System.EventArgs)

   Console.WriteLine("ImageList Changed Event Is Triggered")

   'Here the code which set the Docking Icon dynamically.

   dockingManager1.SetDockIcon(Me.panel1, 0)

   dockingManager1.SetDockIcon(Me.panel2, 1)

End Sub

ProvideGraphicsItems event

The ProvideGraphicsItems event is raised whenever a dockable control caption needs to be painted. The background, foreground, and font of the docked control caption can be customized by using this event. The docked control name, which is to be painted can be displayed using the control property.

Event data

The event handler receives an argument of ProvideGraphicsItemsEventArgs type containing data related to this event. The following ProvideGraphicsItemsEventArgs members provide information specific to this event.

Member Description

CaptionBackground

Gets or sets the brush to be used for drawing the caption background.

CaptionBounds

Gets the bounds of the caption.

CaptionFont

Gets or sets the font to be used for the caption text

CaptionForeground

Gets or sets the color to be used for drawing the caption text and buttons.

Control

Gets the dockable control for which the caption is being drawn.

IsActiveCaption

Gets the active/inactive state of the docking window.

NOTE

If the control is in floating state, DockingManager.ProvideGraphicsItems the event will not be triggered.

private void dockingManager1_ProvideGraphicsItems(object sender, Syncfusion.Windows.Forms.Tools.ProvideGraphicsItemsEventArgs arg)

{

   Console.WriteLine("ProvideGraphicsItems Event Raised"+ i++);

   // Caption Background uses the Brush for Drawing on the caption bar

   arg.CaptionBackground=new LinearGradientBrush(arg.CaptionBounds, Color.Transparent , Color.White, (float)0);

   //Caption Foreground color property will be used to specify the Font color of the caption

   arg.CaptionForeground=Color.Black;

   //Caption Bounds property gives the values of Caption Height, width, Top ,Bottom and

   // More like rectangle control.

   Console.WriteLine("Caption Bounds, Height="+ arg.CaptionBounds.Height+

   "Width="+arg.CaptionBounds.Width);

   //IsActive Caption property gives the docked control is in Active or else. It will return

   // bool value

   if(arg.IsActiveCaption)

     Console.WriteLine("Control Name="+ arg.Control.Name);

}
Private Sub dockingManager1_ProvideGraphicsItems(ByVal sender As Object, ByVal arg AsSyncfusion.Windows.Forms.Tools.ProvideGraphicsItemsEventArgs)

   Console.WriteLine("ProvideGraphicsItems Event Raised" + System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1))

   'Caption Background uses the Brush for Drawing on the caption bar

   arg.CaptionBackground = New LinearGradientBrush(arg.CaptionBounds, Color.Transparent, Color.White, CType(0, Single))

   'Caption Fore ground color property will be used to specify the Font color of the caption

   arg.CaptionForeground = Color.Black

   'Caption Bounds property gives the values of Caption Height, width, Top ,Bottom and

   'More like rectangle control.

   Console.WriteLine("Caption Bounds, Height=" + arg.CaptionBounds.Height + "Width=" + arg.CaptionBounds.Width)

   'IsActive Caption property gives the docked control is in Active or else. It will return

   ' bool value

   If arg.IsActiveCaption Then

     Console.WriteLine("Control Name=" + arg.Control.Name)

   End If

End Sub

ProvidePersistenceID event

This event allows you to specify a unique ID to distinguish the persistence information of different instances of the form type.

Event data

The event handler receives an argument of ProvidePersistenceIDEventArgs type containing data related to this event. The following ProvidePersistenceIDEventArgs members provide information specific to this event.

Member Description

PersistenceID

Allows you to specify a unique ID.
//Lets you specify a unique ID used to distinguish the persistence information of different

//instances of the Form type.

protected void DockingManager_ProvidePersistenceID(object sender,Syncfusion.Windows.Forms.ProvidePersistenceIDEventArgs e)

{

   Console.WriteLine("Provide Persistence ID Event has been raised");

   Syncfusion.Windows.Forms.Tools.DockingManager dockingManager = sender as DockingManager;

   Console.WriteLine("Host control name = "+dockingManager.HostControl.Name.ToString());

   //The docking state stores in a place named as that Host control name.

   e.PersistenceID = dockingManager.HostControl.Name.ToString();

}
'Lets you specify a unique ID used to distinguish the persistence information of different

'instances of the Form type.

Protected Sub DockingManager_ProvidePersistenceID(ByVal sender As Object, ByVal e AsSyncfusion.Windows.Forms.ProvidePersistenceIDEventArgs)

   Console.WriteLine("Provide Persistence ID Event has been raised")

   Dim dockingManager As Syncfusion.Windows.Forms.Tools.DockingManager = CType(ConversionHelpers.AsWorkaround(sender, GetType(DockingManager)), DockingManager)

   Console.WriteLine("Host control name = " + dockingManager.HostControl.Name.ToString)

   'The docking state stores in a place named as that Host control name.

   e.PersistenceID = dockingManager.HostControl.Name.ToString

End Sub

See Also

Context Menu