DockingWindow closes slowly

Docking/MDI for WPF Forum

Posted 3 years ago by Sunshine - Appeon
Version: 21.1.2
Avatar

Example link: https://ibb.co/0Dj2cKy

When I click the close button on DockingWindow, there is a noticeable delay. But it is very quick to close it through the right-click menu. Is there any difference between these two methods?
Currently in our project, after some frequent changes to the contents of the DockSite, all DockingWindow clicks on the close button delay will gradually become slower.

Through code debugging, it is found that the time-consuming operations are all generated before the DockSite.OnWindowsClosing time.

A simple case of this problem cannot be reproduced, but we can be sure that this may be related to the way DockingWindow is closed.

Comments (4)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

There shouldn't really be any difference between those two ways of closing the docking window.

1) The menu item version is tied to DockingWindow.CloseCommand, which calls the DockingWindow.Close() method.

2) Clicking the tab close button raises the AdvancedTabControl.TabClosing event, which is handed in DockingWindowContainerBase.OnTabControlTabClosing.  There it cancel's the default AdvancedTabControl close behavior (by setting e.Cancel = true) and instead calls the DockingWindow.Close() method.  The code raising the AdvancedTabControl.TabClosing event is very simple.

Both go down the same effective path so you shouldn't really see a difference between them.  I'm not really seeing a performance difference here when I test at run-time.  Perhaps you can use a performance profiler app in your scenario to try and narrow down what might be causing the delay.


Actipro Software Support

Posted 3 years ago by Sunshine - Appeon
Avatar

I also think that there should not be a difference, but as you can see in the case, the two methods do have obvious differences. I put a breakpoint at the entrance of DockSite.OnWindowsClosing. The stack information I see is all triggered by external code, so I can't locate the problem.

The behavior of directly clicking the close button and closing them through the menu is the same. So no matter how I write my code, their effects will not be different. But this is different from what we see.

I think it is impossible to test this phenomenon in a simple case without finding the cause. The scene we currently use is more complicated. This phenomenon is not easy for us to recover, but it is inevitable. To reproduce this situation, I need to implement several close and open solutions similar to VS, which will cause many DockingWindow to be closed and opened globally. And the more the number of operations, the longer the delay time. This delay occurred before the DockSite.OnWindowsClosing event.

Posted 3 years ago by Sunshine - Appeon
Avatar

Source code version:21.1.2

Location: \Docking\UI\Controls.Docking\AdvancedTabItem:line 452

Through source code debugging, it is found that the delay is before the close command is triggered. And it will only be triggered here when the close button is clicked.

In addition, whether there is the source code of the ActiproSoftware.Controls.WPF.DataGrid.Contrib package, I have not found this package for the time being, because of conflicts, "ActiproSoftware.Shared.Wpf.dll" cannot be traced

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The AdvancedTabItem constructor calls a CreateCommands method that creates commands used for that particular "tab".  The CloseCommand here is bound in XAML to the close button's Command property.

The second line below is line 452.

closeCommand = new DelegateCommand<object>((param) => {
	var tabControl = this.OwnerTabControl;
	if ((tabControl != null) && (!tabControl.RaiseTabClosingEvent(this)))
		this.Close();
});

And all the OwnerTabControl property does is call ItemsControl.ItemsControlFromItemContainer to get the AdvancedTabControl.  It's all pretty simple.

For your other question, the ActiproSoftware.Controls.WPF.DataGrid.Contrib package is open source and its source is here on GitHub.


Actipro Software Support

The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.