To reproduce: Create MDI form using RadDock by following the article: http://www.telerik.com/help/winforms/dock-mdi-mode-automatic-mdi-form-handling.html You will notice that the Closing and Closed events of the MdiForms will not be invoked. Workaround: Subscribe to the FormClosing event of the main Form and close all the windows manually: void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.RadDock.CloseAllWindows(); }
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: //Form1.cs protected override void OnClosing(CancelEventArgs e) { base.OnClosing(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.
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.