Hi Craig,
Query#1: The CloseButtonClick event is great when you close one document, but I was using the OnDockStateChanging e.Cancel intentionally as if you right click, close all for example the CloseButtonClick doesn't get fired. I need an event when closing all where I can cancel the closing process. Setting OnDockStateChanging e.Cancel to True should work but doesn't?
To cancel the closing of all document tabs in DockingManager, you can use the DocumentClosing event of DocumentContainer. The same has depicted in the following code:
(TableDockingManager.DocContainer as DocumentContainer).Loaded += MainWindow_Loaded; void MainWindow_Loaded(object sender, RoutedEventArgs e) { (TableDockingManager.DocContainer as DocumentContainer).DocumentClosing += MainWindow_DocumentClosing; } void MainWindow_DocumentClosing(object sender, CancelingRoutedEventArgs e) { e.Cancel = true; } |
Query#2:So here is a visual of what is happening when you set e.Cancel to true in the OnDockStateChanging event. The docked tab becomes half-closed, half-open. In the bottom screenshot you can see the rounded border. If I try add a new window, the old one is still present but you can't dock it. As a reminder, the docked window is based on a simple user control. Hope this helps?
We have tried closing the document and docked window by setting e.Cancel to true in DockStateChanging event, but we were unable to replicate the half closed and half-open issue. Could you please get back to us with modified sample reproducing the issue along with replication steps, it would be helpful for us to proceed further on this.
Sample:
TabControlExt_124023_ModifiedNEWRegards,
Vijayalakshmi V.R.