[Version 2.0] Close Query

Jul 19, 2012 at 12:11 PM
Edited Jul 19, 2012 at 12:13 PM


I want to write an Application like a tabbed Notepad. In each Tab I have my own Control (e.g. like Textbox) and I want to show a question if a Tab is closing ("Do you really want to close tab?").

When I open a new Window with the Control inside I do the following in the "childwindow":


parentWindow = Window.GetWindow(this);
parentWindow.Closing += new CancelEventHandler(OnQueryClose);
private void OnQueryClose(object sender, CancelEventArgs e)
      e.Cancel = true;

So the window can't be closed and I could make a Question-Dialog before the "Cancel".
Can I do something like this with Avalon?
Aug 2, 2012 at 8:06 PM

Does nobody have the same problem?

I try to explane it easier: I want to cancel the Close-Method of an open Document of AvalonDock if an Bool-Var is true. Can I do this with avalon or is it a planned feature. I would really need it...

Aug 3, 2012 at 8:49 AM

Are you using the a MVVM model in your application? if no just handle the DocumentClosing event of the DockingManager and set e.Cancel = false. In MVVM scenario attach the close command for the document as shown in the attached MVVM sample application,


Aug 8, 2012 at 12:23 PM

Thanks, this works :-)