How to programmatically dock a tool window under MDI area without stretching it horizontally

Docking/MDI for WPF Forum

The latest build of this product (v24.1.2) was released 2 months ago, which was before this thread was created.
Posted 10 days ago by Miroslav Kovach
Version: 23.1.4
In our product we only use Docking/MDI programmatically, nothing is preconfigured in XAML. One of our use cases is having a document tab and a tool window at the bottom, which can be opened and closed at any time, below MDI area. One of our users complained that when another tool window is docked on the left or the right then newly opened tool window on the bottom takes the whole viewport horizontally, so that previously docked left/right tool window is resized vertiaclly.
Here is an illustrative screenshot:
We open new tool windows in the following way:
var window = new ToolWindow(dockSite)
	State = DockingWindowState.Docked,
	DefaultDockSide = Side.Bottom
Setting e.Target in DockingWindow.DefaultLocationRequested and DockSite.WindowDefaultLocationRequested doesn't make window appear directly under MDI area, it still takes the whole horizontal dimension.
But we figured that calling window.Dock(dockSite.DocumentWindows.FirstOrDefault(), Side.Bottom) after opening a new tool window results in something very close to what we need but it makes State == DockingWindowState.Document. It actually corresponds to one of the options that appear when a window is dragged in GUI. But we need another option, the bottom one (State = DockingWindowState.Docked).
See screenshot:
How can it be achieved programmatically?

Comments (1)

Answer - Posted 10 days ago by Actipro Software Support - Cleveland, OH, USA


If you have an x:Name on the Workspace, then I believe you can call the ToolWindow.Dock(workspace, Side.Bottom) method to dock it how you are looking for, which is directly under the Workspace. 

Calling the ToolWindow.Dock(dockSite, Side.Bottom) method on the other hand would dock it like you are currently seeing when you call Open().

Actipro Software Support

Add Comment

Please log in to a validated account to post comments.