Save yes/no/cancel on closing a ToolWindow

Docking/MDI for WPF Forum

Posted 16 years ago by Alex Dunbar
Version: 4.0.0456
I am building an application to edit business objects from a database. I would like the user interface to work like Visual Studio, in as much that closing an individual tab forces a user to save or discard changes.

When editing an object, I create a ToolWindow programatically for that object and then set it up as a tab in a Tabbed MDI area. If I close one of the tabs after making an edit, I would like to have a MessageBox (or similar) pop up with a 'Save changes? yes/no/cancel' dialog. Is there any way to trigger this dialog without an OnClosing event in the ToolWindow?

I am still quite new to WPF and .net programming.

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Alex,

The DockSite has a WindowClosing event on it where you could do this. I'm not sure how you would do it without handling either that or the ToolWindow.OnClosing as you mentioned though.

Actipro Software Support

Posted 16 years ago by Alex Dunbar
Thanks. Got it working with DockSite.WindowClosing. Once I knew what to look for, I found the example in the demo software in ProductSamples\DockingSamples\Demo\Features\MainControl.xaml.cs
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.