How to add DocumentContent at runtime.

Mar 14, 2009 at 3:39 AM

I'm migrating a project from Windows Forms to WPF and I've come upon a problem that's got me stumped.  Under Windows Forms, I was using Weifen Luo's docking library.  With that library I was very easily able to create my own "DocumentContent" and add it to the "DockingManager" at runtime.  However, using AvalonDock I can't seem to figure out how to do the same thing.  Any help would be appreciated.

Mar 2, 2010 at 9:37 AM

Hi. I am very new to WPF, but have done a bit of WinForms and programming. Please can someone post a simple example on doing this? I basically want to build my form, and add it at run time. Thanks.

Mar 2, 2010 at 10:03 AM

Never mind, I found it! After days of searching it has finally come to me LOL.


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Dim myDoc As New AvalonDock.DocumentContent

        myDoc.Title = "Test Tab"
        myDoc.Content = New UserControl2
        myDoc.IsFloatingAllowed = True

    End Sub