This project is read-only.

[Version 2.0] DockingManager in ElementHost

Sep 20, 2012 at 4:18 PM

Is there a way to place a DockingManager in ElementHost?

I want to use DockingManager in a WinForm application but when I try, VisualStudio 2010 freezes and I must kill him.

After re-open the project (with a warning), I succeed to compile but the resulting application crashes with null reference exception in the Avalon assembly.

Sep 24, 2012 at 12:13 PM

See my question at

Sep 28, 2012 at 1:46 PM

I reminds that I use winform application.

Ok, your solution works for compilation and execution.


But after moving dockable contents I can't move or resize the main window. And setting a content in the float state crash the application with "The value cannot be null. Parameter name : window" when I try to redock it or move the main window.

It looks like if DockingManager try to use the MainWindow of the WPF application we create, but it was not set.

There's a way to set the WPF Application main window with the current Winform application main window ?

Something like :

    Private Sub MyApplication_Startup(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
      Dim pWPFApplication As New System.Windows.Application
      pWPFApplication.MainWindow = Me.MainForm
    End Sub

Without the invalid cast between 'System.Windows.Forms.Form' and 'System.Windows.Window'.

Sep 29, 2012 at 12:33 PM

I think your trying to do this backwards! You should try hosting your winforms controls in a WPF Application

or are you hosting your WPF Controls correctly in your WinForms Application?

Oct 1, 2012 at 4:18 AM

I also face same issues nmarquez is facing. Hosting winforms in wpf application is not always possible. For example our product is just a plugin of another product which is a Winforms application.

Oct 1, 2012 at 9:09 AM

Thanks for your answer.

You are on the right way with your analyze of the situation. I'm newbie with WPF and having a lot of Winforms code, so I prefer use Winforms application if it's possible.

I've try the both : using my stuff in WPF and Winforms application. There's a lot of troubles using AvalonDock on Winforms app while WPF app seems to work correctly. So, I'll probably rewrite my code for WPF applications but it is a long task that I wish to avoid.

Oct 1, 2012 at 2:58 PM


with latest version AvalonDock 2.0 is finally embeddable inside ElementHost control. Please the WinFormsTestApp for a sample application,


Oct 2, 2012 at 5:11 AM

Great news !! Thanks for the effort.

I downloaded latest code and tried it. It seems to be working. However when I try to dock a floating window back, it gives assertion error. However release build seems to be working. So far so good !

Oct 2, 2012 at 8:02 AM

Yes, I left some assertion on debug build just test purposes, thx, Ado

Oct 2, 2012 at 8:54 AM

What do you call "latest" version ?

I use 2.0.1320 for several weeks and it seems to be the latest version for me.

Oct 2, 2012 at 9:25 AM

Please download latest sources from 'Source Code' tab here on codeplex, 2.0.1320 is the public stable release, Ado

Oct 2, 2012 at 9:29 AM

OK. I'll try immediately.


Oct 2, 2012 at 9:44 AM

My winforms application seems working fine with the 2.0.1507 version.

Great job.

Oct 2, 2012 at 10:36 AM

It seems that no more needs to instantiate System.Windows.Application.

Dec 13, 2012 at 10:27 AM

Thanks for this great project.

I'm new to AvalonDock. Until now I used Weifenluo dock suite. I am working with WinForms (.NET 3.5). I downloaded the provided WinForms sample code and managed to get it running. However, I would like to add a new WinForm to the project and show it in the document pane. How am I supposed to do that??

Any help or tip would be greatly appreciated ;o)