AnsweredAssumed Answered

How do you instantiate dockpane programattically?

Question asked by james.gough_WSSC on Apr 16, 2020

I have an add-in with a button and a couple of mapTools in a group, as well as a dockpane (The buttons are not in the dockpane). When the button is pressed it runs a GPService, and when that service finishes, the results are displayed in the dockpane.

 

Right now, this is working, but only if you manually open the dockpane before running the tool (by clicking the ShowButton).

 

If the dockpane is not opened manually then FrameworkApplication.DockPaneManager.Find() returns null since the dockframe instance has not been created.. 

 

I have tried calling the Show() method on the viewmodel (since this gets called when you click the button), however this does not seem to actually create the dockpane instance.

 

I am also using the FrameworkApplication.DockPaneManager.IsDockPaneCreated() method, but it explicitly says that  "This function will not create the dock pane if it does not exist."

 

I can't find anywhere where it says how to create this instance. I see in the documentation where it says:

Dock panes are singletons: there is never more than one instance of a particular dock pane and once created, they are not destroyed until the application shuts down. Use Find to access a specific dock pane.

 

So how can you actually create that instance if it does not exist?

Outcomes