@AlexFielder Ok, so on the subject of dockable windows here is what I did.
I wasn't able to get a WPF Window to work so I just created a blank System.Windows.Forms.Form then dropped an ElementHost on it and docked it in the parent container. As far as the design, that's all I had to do. It doesn't matter what size you set the form as it will automatically adjust to fit the dockablewindow. Also, you can do this in a WPF Class Library, I did not have to create an old Windows Forms Class Library. You just need to add a reference to the System.Windows.Forms namespace.
Here is what the Form looks like in the code behind...
Imports Inventor
Public Class DWForm
Public Sub New(InvApp as Inventor.Application, InternalName As String, WindowTitle As String, WPFControl As UIElement, Optional ShowTitle As Boolean = True)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
'Pass the WPFControl to the ElementHost
Me.ElementHost1.Child = WPFControl
'Create the Dockable Window.
Dim DocWin = InvApp.UserInterfaceManager.DockableWindows.Add(CLID, InternalName, WindowTitle)
'Add the current form to the dockable window.
DocWin.AddChild(Me.Handle)
'Controls the Title Bar Visibility.
DocWin.ShowTitleBar = ShowTitle
'Make sure the dockable window and the child form are visible.
DocWin.Visible = True
Me.Visible = True
'Ensure the child window chrome is turned off.
Me.FormBorderStyle = Forms.FormBorderStyle.None
End Sub
End Class
The above class allows you to create dockable windows over and over without having to write this code out every time.You just create a new instance of this class and pass in a unique InternalName and the WPF element to be hosted. It's worth noting that the CLID variable (in red) I have in my add-ins as a global variable with my add-in's CLID, you could change the method signature and add that as a parameter to pass in.
Here is how you create multiple instances of dockable windows, this is in my Activate method....
'Hook into the Inventor Application object...
_InvApp = AddInSiteObject.Application
Dim DocFrm1 = New DWForm(_InvApp, "FUTE_DW_1", "Window 1", New QuickProps, False)
Dim DocFrm2 = New DWForm(_InvApp, "FUTE_DW_2", "Window 2", New iPropertyBlock, False)
The QuickProps & iPropertyBlock (in blue) are just WPF User Controls that I have created in my project. I am literally creating them as I pass them into the form. You should build all of you logic and binding into your WPF controls and simply use the form to host it. It may get complicated if you start trying to throw controls on the Windows Form as well.
Anyway, I hope that helps!
Let me know if you have any issues with the code.
-Addam
Automation is key!