Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have tried my best to resolve this. Any help would be greatly appreciated.
I am trying to create a plug in which should entirely run in a Dockable Pane. When I close the revit documentI get the following error message:
System.InvalidOperationException
HResult=0x80131509
Message=BuildWindowCore failed to return the hosted child window handle.
Source=PresentationFramework
The implementation is as follows;
The IExternalApplication
public class Main : IExternalApplication
{
public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
public Result OnStartup(UIControlledApplication application)
{
MyPage page1 = new MyPage();
application.RegisterDockablePane(DockablePaneIdProvider.GetDockablePaneId(), "MyPage", (MyPage)page1);
return Result.Succeeded;
}
}
The IExternalCommand
public class Dockable : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
UIApplication uiapp = commandData.Application;
Document document = uiapp.ActiveUIDocument.Document;
// Show the dockable pane
DockablePane dockablePane = uiapp.GetDockablePane(DockablePaneIdProvider.GetDockablePaneId());
dockablePane.Show();
return Result.Succeeded;
}
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
}
}
}
The xaml.cs for the Page
public partial class MyPage : Page, IDockablePaneProvider
{
public MyPage()
{
InitializeComponent();
}
public void SetupDockablePane(DockablePaneProviderData data)
{
data.FrameworkElement = this as FrameworkElement;
data.InitialState.DockPosition = DockPosition.Tabbed;
}
}
The DockablePaneIdProvider
public class DockablePaneIdProvider
{
public static DockablePaneId GetDockablePaneId()
{
DockablePaneId paneId = new DockablePaneId(new Guid("3BC54A55-CB65-48F1-9520-A1B2523823A7"));
return paneId;
}
}
Solved! Go to Solution.