Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > DockWindow contents disappear on confirm closing

Answered DockWindow contents disappear on confirm closing

Feed from this thread
  • Sergi avatar

    Posted on Jun 22, 2011 (permalink)

    I want to add a confirm dialog when a user tries do close a dockwindow, I'm using the raddock as a mdicontainer, I use the DockWindowClosing event:

    private void radDock1_DockWindowClosing(object sender, DockWindowCancelEventArgs e)
    {
      if (RadMessageBox.Show("Are you sure", "Confirm", MessageBoxButtons.YesNo, RadMessageIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.No) {
          e.Cancel = true;
      }
    }

    The problem is that when I call RadMessageBox.Show, all the contents of the radwindow disappear.

    How can I fix this so that I can ask for confirmation when closing a raddock window?

    Thanks in advance.

    Reply

  • Sergi avatar

    Posted on Jun 22, 2011 (permalink)

    I know why it fails, the mdi form that is the content of the radwindow gets closed even before the dialog is shown.

    I think it's a bug because even if I cancel the event the mdi form gets closed.

    Any help on how to fix it?

    Thanks in advance.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Answer Nikolay Nikolay admin's avatar

    Posted on Jun 22, 2011 (permalink)

    Hello Sergi,

    Thank you for your question.

    The closing events are fired in the following order:

    FormClosing of the form
    FormClosed of the form
    DockWindowClosing of the DockWindow that hosts your form
    DockWindowClosed of the DockWindow that hosts your form.

    So, in order to achieve your scenario, you should implement your logic in the FormClosing event handler of the form.

    I hope that this information helps. If you have additional questions, feel free to contact me.

    Greetings,
    Nikolay
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.

    Reply

  • Sergi avatar

    Posted on Jun 23, 2011 (permalink)

    Thanks, I thought it was counterintuive that it works that way, but now I see the adventages of closing from inside out.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > DockWindow contents disappear on confirm closing
Related resources for "DockWindow contents disappear on confirm closing"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]