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 to dispose a docking managers control which is already docked?

 

We can dispose the docking manager controls using Application_Idle event. We have to keep track the docking managers control using ArrayList whenever the docking state is changed. After the state is changed the Application_Idle event gets fired, we can dispose a particular control by checking its state. The following code fragment shows an implementation for disposing off the floating windows.

C#

// ArrayList to keep track of floating docking windows to be disposed later

private ArrayList alDisposed = new ArrayList();

// Storing control in floating states

void dockingManager1_DragFeedbackStop(object sender, EventArgs e)

{

for (int i = 0; i < this.dockingManager1.ControlsArray.Length; i++)

{

ctrl = this.dockingManager1.ControlsArray[i];

if (dockingManager1.IsFloating(ctrl))

{

this.alDisposed.Add(ctrl);

}

}

}

// Dispose off the closed docking windows from within the Application.Idle event handler

void Application_Idle(object sender, EventArgs e)

{

int ncontrols = this.alDisposed.Count;

if (ncontrols > 0)

{

Control[] ctrlstodispose = (Control[])this.alDisposed.ToArray(typeof(Control));

this.alDisposed.Clear();

for (int i = 0; i < ncontrols; i++)

{

Control ctrl = ctrlstodispose[i];

this.dockingManager1.SetEnableDocking(ctrl, false);

this.Controls.Remove(ctrl);

ctrl.Dispose();

}

}

}

VB

' ArrayList to keep track of floating docking windows to be disposed later

Private alDisposed As ArrayList = New ArrayList()

' Storing control in floating states

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

Do

ctrl = Me.dockingManager1.ControlsArray(i)

If dockingManager1.IsFloating(ctrl) Then

Me.alDisposed.Add(ctrl)

End If

Loop

End Sub

' Dispose off the closed docking windows from within the Application.Idle event handler

Private Sub Application_Idle(ByVal sender As Object, ByVal e As EventArgs)

Dim ncontrols As Integer = Me.alDisposed.Count

If ncontrols And gt; 0 Then

Dim ctrlstodispose As Control() = CType(Me.alDisposed.ToArray(GetType(Control)), Control())

Me.alDisposed.Clear()

Do

Dim ctrl As Control = ctrlstodispose(i)

Me.dockingManager1.SetEnableDocking(ctrl, False)

Me.Controls.Remove(ctrl)

ctrl.Dispose()

Loop

End If

End Sub

Please refer the sample in the below link which illustrates the above: http://help.syncfusion.com/support/samples/kb/tools.windows/39808/SampleProject.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
1717 04/30/2011 07/10/2014 ASP.NET Web Forms (Classic) Snap
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

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

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