Docking tool windows in code-behind

Docking/MDI for WPF Forum

Posted 6 years ago by Greg Kilmatead
Version: 18.1.0675
Avatar

Hello, when I am trying to dock a tool window to a dock site or workspace, I first have to run the Open method on it or the Autohide method, and then call the Dock method, otherwise the tool window is not displayed.

Is there any reason that happens?

(note: I do all my layouts in C# code, completely skipping XAML)

Comments (5)

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

Hi Greg,

That shouldn't be necessary.  I just tested creating a ToolWindow and calling Dock() and it worked fine:

var tw = new ToolWindow(dockSite, "Test", "Test", null, "Test content");
tw.Dock(dockSite, Side.Left);

The only thing I could think of is if perhaps you were targeting some docking object with a tool window but that object hadn't yet been loaded.  Perhaps in that case it wouldn't succeed?  If the above doesn't work, please tell us some simple XAML like above that we could test with.  Thanks!


Actipro Software Support

Posted 6 years ago by Greg Kilmatead
Avatar

Indeed , you are right, I was targeting a DockSite, but it was probably not loading in time to dock the tool window.

When trying to dock the tool window after the DockSite has loaded (by handling the Loading event) it worked as expected.

Thank you for pointing me in the right direction.

Posted 6 years ago by Greg Kilmatead
Avatar

Also, as a side note regarding the support forums, I am not able to post questions from a Firefox browser (v54 or v56), nor can I mark a comment as an answer.  I can post comments, but I can't post threads. I had to post this thread from a Google Chrome browser.

Posted 6 years ago by Greg Kilmatead
Avatar

P.S. apparently the comment was marked as the answer after attempting several times and with a delay.

I wanted to add this piece of information in my last comment, but it wouldn't let me edit it after trying more than 5 times.

Feel free to remove these comments, I don;t want to flood the thread, I just wanted to inform you about it.

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

Hi Greg,

Thanks for telling us.  Another user had reported that in the past but we were never able to reproduce it.  We hadn't tried with Firefox though, and I believe we now narrowed down what scenario Firefox wasn't liking on the Create Thread submission.  It should be working now and let us know if you see more problems in the future.  We have a web site forum that you can post in for those kinds of things.  Thanks!

[Modified 6 years ago]


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.