Docking windows are not activated after loading a layout

Docking/MDI for WPF Forum

Posted 5 years ago by Jan H.
Version: 19.1.0683
Platform: .NET 4.6
Environment: Windows 10 (64-bit)

After updating our project from build 673 to 682 (the issue appears in 683 as well), we're having problems with window selection/focusing when loading layouts.

After loading the layout data from storage, we load it into the docking, then we try to activate the window with the highest LastActiveDateTime. The window is correctly determined and brough to the front, but after a call to Activate(focus: true), no tab is focused.

Simple workarounds (focusing the dock site, giving keyboard focus to the document window) that work in the sample project do not work in the real project.

Thanks in advance for your help.

Best regards,


Comments (2)

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

Hi Jan,

I'm sorry you're having trouble.  It's hard to say what it could be without being able to debug it.  Can you please put together a new simple sample project that shows the issue happening and send that to our support address, mentioning this thread?  Be sure to remove the bin/obj folders from the ZIP you send and rename the .zip file extension so it doesn't get spam blocked.  Then we will debug with that to see what is causing the problem.  Thanks!

Actipro Software Support

Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Jan,

Thanks for the sample project.  The problem is that while we have deserialized all the controls at the point you try to activate the document window, the control hierarchy hasn't yet been "loaded" by WPF.  So focus is unable to be set to any controls at that time.

There are two options you can do choose from.

1) Load layout after DockSite.Loaded

The first option is to not load your layout in the window constructor but rather in the DockSite.Loaded event the first time, like this:

private bool isDockSiteLoaded;
private void TestDockSite_Loaded(object sender, RoutedEventArgs e) {
	if (!isDockSiteLoaded) {
		isDockSiteLoaded = true;
		Load();  // Load layout in this method


2) Dispatch the window activation

Keep things as-is in your sample but move the document window activate call until after WPF "loads" the UI, like this:

this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (Action)(() => {
	window?.Activate(focus: true);

Either of those should work.

Actipro Software Support

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.