Different behaviors for Dock command in a floating ToolWindowContainer

Docking/MDI for WPF Forum

Posted 4 years ago by Alex
Version: 19.1.0685
Platform: .NET 4.7
Environment: Windows 10 (64-bit)


I have noticed inconsistent behavior with the Dock command, when we have a floating ToolWindowContainer with ToolsWindow in it. If I right click on the title bar (ToolWindowContainerTitleBarContextMenu) and select Dock, the entire ToolWindowContainer with all it's ToolWindows are docked in the main DockSite, at the previous location it was when the ToolWindowContainer was in a Docked state. This is a behavior that we want in our software, to restore the whole group back in the DockSite with a simple click command, so clients with trackpad doesn't have to drag the floating window back on the DockSite. It's a less tedious process with a clickable command in ContextMenu or the Options menu.

However, if we have floating ToolWindowContainer with ToolsWindow in it and click on the options menu (ToolWindowContainerTitleBarOptionsMenu) and select Dock, only the current ToolWindow in the ToolWindowContainer is moved to the DockSite and becomes docked. The other ToolWindow in the floating container are still floating. If we have 5 ToolWindows in the floating container, we will need to do that process 5 times before all those windows are in the docked ToolWindowContainer.

I would have expected that the Dock command from either the context menu or the options menu have the same effect when ToolWindowContainer is floating. Because it is the case when the container is docked and you choose Float from the context or options menu (it will make only the current tool window floating, not the whole container).

This can be reproduced easily in your example demo Simple IDE.

Is it a bug from your side? Otherwise, is there a way to specify that, when we have a ToolWindowContainer in floating mode, that the Dock command in the Options menu have the same behavior than in the context menu, and sends the whole ToolWindowContainer in docked state?

I hope the explaination was clear enough and let me know if you have any additional questions.

Thank you,


Comments (2)

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

Hi Alex,

An enhanement to address the inconsistencies you noted in the context menus has been logged. Specifically, the context menu displayed when you right-click on the title bar of a ToolWindowContainer (multiple ToolWindow instances grouped as tabs) has slightly different logic for the "Dock", "AutoHide", and "Close" commands. As you noted, the "Dock" command on the ToolWindowContainer will dock all of the tool windows, but the "Dock" command shown on the standard ToolWindow context menu (like that displayed from the "Options" button or the context menu of a tool window tab) will only dock the individual ToolWindow.

If you want to alter the behavior of the "Dock" command on the tool window context menu to behave like that of the container, you will need to customize the menu.  The Sample Browser application has a "Custom Context Menu" QuickStart that introduces the concept. You'll want to listen for the DockSite.MenuOpening event and then the DockingMenuEventArgs.Menu property will provide access to the default menu. You should be able to find the Dock menu item and change the MenuItem.Command property from the default (which would point to the ToolWindow.DockCommand of the selected ToolWindow) to the ToolWindowContainer.DockCommand of the container instance for that tool window. With that command change, you should see the functionality want.

Note that a tool window may not always be in a ToolWindowContainer, so be sure to test your customization on a tool window that is also in something else, like a TabbedMdiContainer.

[Modified 4 years ago]

Actipro Software Support

Posted 4 years ago by Alex

Thank you for your fast answer, we will use your suggestion.

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.