Docking a toolwindow to an inner area in code

Docking/MDI for WPF Forum

Posted 15 years ago by RS
Version: 4.5.0486
Avatar
I have a pretty basic initial docking layout:

<dock:DockSite x:Name="_DockSite">
        <dock:Workspace x:Name="_Workspace">
            <dock:TabbedMdiHost x:Name="_MdiHost">

            </dock:TabbedMdiHost>
        </dock:Workspace>
    </dock:DockSite>
I then add, in code a tool window docked to the left. What I would like to do then is to dock another toolwindow above the tabbed mdi area, but have it only stretch the width of the control minus the left toolwindow width. If I dock with a direction of "Top", the toolwindow stretches the whole width of the control and the toolwindow on the left gets shifted down. I tried passing the Workspace as the relative docksite to the .Dock method, but the result is the same. I can do this interactively by dragging my toolwindow over the document area and choosing the top icon from the docking diamond - just can't figure out how to do that in code.

So I guess my question is what's the trick to this kind of "inner docking"?

RS

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello, I was able to do it as you wanted with this code:
ToolWindow tw = new ToolWindow(dockSite, "TW1", "TW1", null, null);
tw.Dock(dockSite, Direction.Left);
tw = new ToolWindow(dockSite, "TW2", "TW2", null, null);
tw.Dock(workspace, Direction.Top);
That is using a slightly newer codebase though so I'm not sure if a change we've made since the currently official maintenance release fixed some related bug or not. I assume you have the current maintenance release.


Actipro Software Support

Posted 14 years ago by Roger Rong
Avatar
I was trying to manage the initial tool window dock position using your above code:

tw.Dock(dockSite, Direction.ContentLeft);

or

tw.Dock(workspace, Direction.ContentLeft);

But I got exceptions in both situation:

Docking via Direction.Content into target 'ActiproSoftware.Windows.Controls.Docking.DockHost' is not supported.

or

Docking via Direction.Content into target 'ActiproSoftware.Windows.Controls.Docking.Workspace' is not supported.

I am using version 9.2.515.0

Is it a bug or I did not use in the correct way?

[Modified at 04/07/2010 11:24 PM]

[Modified at 04/08/2010 03:44 AM]
Posted 14 years ago by Roger Rong
Avatar
Got the answer from the following thread:

http://www.actiprosoftware.com/Support/Forums/ViewForumTopic.aspx?ForumTopicID=3262#12107

My problem was using a wrong dock direction value: Direction.ContentLeft. It works after it is changed to Direction.Left.
The latest build of this product (v24.1.1) 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.