DockableWindow is a bit tricky here since it is implemented by two classes - 1) the UI part is the designer surface derived from controls and 2) the non-UI part is the class actually inherits from DockableWindow base class. FromID can only handle types derived from base classes declared in ESRI.ArcGIS.Desktop.AddIns.dll. You have to pass in the type that inherits DockableWindow, which is the inner class of the designer window itself if you are using the Add-in Wizard. If you go to the xml declaration of the dockable window, you will see the class attribute is set to �??DockableWindow1+AddinImpl�?�. You have to pass this type to get the dockablewindow implementation class first, then you have to expose a property there get a hold of the UI window.
public class DockableWindow1 : UserControl
{
...
/// <summary>
/// Implementation class of the dockable window add-in. It is responsible for
/// creating and disposing the user interface class of the dockable window.
/// </summary>
public class AddinImpl : ESRI.ArcGIS.Desktop.AddIns.DockableWindow
{
private DockableWindow1 _windowUI;
...
internal DockableWindow1 UI
{
get { return _windowUI; }
}
}
}
var winImpl = AddIn.FromID<DockableWindow1.AddinImpl>(ThisAddIn.IDs.DockableWindow1);
DockableWindow1 dock = winImpl.UI;