This is a migrated thread and some comments may be shown as answers.

DockWindowClosing event issue

2 Answers 171 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Peter Szintai
Top achievements
Rank 1
Peter Szintai asked on 03 Jul 2011, 11:31 PM
Hi All,

Based on this forum thread I tried to obtain the affected child window of the DockWindowClosing event :

private void raddock_DockWindowClosing(object sender, Telerik.WinControls.UI.Docking.DockWindowCancelEventArgs e)
{
    //closing windows
    System.Windows.Forms.Form WindowClosing;
     
    //dockwindow
    if (e.DockWindow is Telerik.WinControls.UI.Docking.HostWindow)
 
        //can convert
        if (((Telerik.WinControls.UI.Docking.HostWindow)e.DockWindow).Content is System.Windows.Forms.Form)
 
            //save the closing window
            WindowClosing = (System.Windows.Forms.Form)((Telerik.WinControls.UI.Docking.HostWindow)e.DockWindow).Content;

But, the ((Telerik.WinControls.UI.Docking.HostWindow)e.DockWindow).Content is always null.

Is there any problem in my code, or it is a bad feature?


Best regards,

Peter

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 05 Jul 2011, 05:41 PM
Hi Peter,

Thank you for writing.

Please refer to my response at the bottom of the following forum thread:
http://www.telerik.com/community/forums/winforms/dock/closing-an-mdi-child-form.aspx

Shortly said, it is normal to get null for the form, because on the DockWindowClosing event the form does not exists anymore.

If you have additional questions, please describe your scenario. This will allow me to provide you with a helpful response.

Best wishes,
Nikolay
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Peter Szintai
Top achievements
Rank 1
answered on 05 Jul 2011, 08:27 PM
Hi Nikolay,

Thanks, now I understand, that there is host window and content form, they are different controls.


Regards,

Peter


Tags
Dock
Asked by
Peter Szintai
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Peter Szintai
Top achievements
Rank 1
Share this question
or