Category / Section
How to know the docking window which is currently being closed in WinForms Docking Manager?
1 min read
Docking event
You can use the DockVisibilityChanged event to know the control visibility status. This event triggers after the control's visibility has changed (i.e when you click on the "x" button of the docking windows).
You can also use dockingManager.GetDockVisibility(control) method to know the current status of the docking window.
Note:
When we close the docking window using the "x" button, it only hides the window and does not dispose the docked controls.
C#
//this event triggers when the control's visibility has changed. private void dockingManager1_DockVisibilityChanged(object sender, Syncfusion.Windows.Forms.Tools.DockVisibilityChangedEventArgs arg) { //GetDockVisibility method 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."); } }
VB
'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 method 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
UG document link: https://help.syncfusion.com/windowsforms/dockingmanager/docking-events#dock-visibility