DockWindowClosing event issue

3 posts, 1 answers
  1. Peter Szintai
    Peter Szintai avatar
    28 posts
    Member since:
    Jul 2009

    Posted 03 Jul 2011 Link to this post

    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. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 05 Jul 2011 Link to this post

    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!

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter Szintai
    Peter Szintai avatar
    28 posts
    Member since:
    Jul 2009

    Posted 05 Jul 2011 Link to this post

    Hi Nikolay,

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


    Regards,

    Peter


Back to Top