Last Updated: 12 Feb 2015 08:48 by ADMIN
Created on: 12 May 2014 11:35
Category: Dock
Type: Bug Report
FIX. RadDock - Closing the main Form should close the MdiChildren of the dock
To reproduce:

Create MDI form using RadDock by following the article: You will notice that the Closing and Closed events of the MdiForms will not be invoked.


Subscribe to the FormClosing event of the main Form and close all the windows manually:

void Form1_FormClosing(object sender, FormClosingEventArgs e)
Ivan Todorov
Posted on: 02 Feb 2015 14:09
Looking further into this, we did not manage to find a proper way for a child control to prevent its form from closing (assuming that the control might change forms at runtime). What we can do is make the CloseAllWindows return a boolean indicating if all windows were successfully closed. This will let you implement this scenario the following way:

        protected override void OnClosing(CancelEventArgs e)
            e.Cancel = !this.radDock1.CloseAllWindows();

If you need any additional customizations, you can use the GetWindows method or the DockWindows collection to check the windows that were left open after CloseAllWindows was called.
Phil Lindquist
Posted on: 12 May 2014 13:19
The work-around causes the FormClosed and FormClosing events to be invoked before the main form is closed.  That is fine.  However if you set e.Cancel = true in the FormClosing handler of one of the child windows it will not prevent the main form from closing.  That is not so good.  I'm not sure if Telerik will be able to make that work but it is highly desirable.