Select to view content in your preferred language

Is there a way to detect a Dockpane is on/opened when ArcGIS Pro started?

1212
2
Jump to solution
11-03-2021 06:19 AM
Amadeus111
Frequent Contributor

I am creating some tools nested in a Dockpane. I would like to see if I can detect the status of the Dockpane. Whether Dockpane is on and in the main view or not turned on at all and it needs to be turned on via Add-In tab. 

When a user initiates it, some layers will be added to TOC automatically. However, if it is already on and ready user will load the layers manually via a button maybe.

My idea is to give a better experience to end-users. When a user initiates the Dockpane s/he most likely to use those layers however if the Dockpane is on when Pro started it does not mean a user will utilize those layers or the tools within the Dockpane. 

Please let me know if you have a better/alternative way to handle this type of situation. 

0 Kudos
1 Solution

Accepted Solutions
KrisCulin
Frequent Contributor

First you should use:

var pane = FrameworkApplication.DockPaneManager.Find(name);

This will attempt to find the dock pane with the given name.

If pane is not null, it was found.  Then you can use:

FrameworkApplication.DockPaneManager.IsVisible(name)

where "name" is the name of your DockPane.  It will tell you if the dock pane is visible or not.

The null check is not strictly required but I found that it works better if you try not to get a dock pane that doesn't exist.

HTH.

Kris

View solution in original post

2 Replies
KrisCulin
Frequent Contributor

First you should use:

var pane = FrameworkApplication.DockPaneManager.Find(name);

This will attempt to find the dock pane with the given name.

If pane is not null, it was found.  Then you can use:

FrameworkApplication.DockPaneManager.IsVisible(name)

where "name" is the name of your DockPane.  It will tell you if the dock pane is visible or not.

The null check is not strictly required but I found that it works better if you try not to get a dock pane that doesn't exist.

HTH.

Kris

Amadeus111
Frequent Contributor

Works like a charm - Thanks.

0 Kudos