Is there an easy way to open/activate the catalog pane through the SDK?

629
2
Jump to solution
06-14-2021 02:10 PM
JKing_Esri
New Contributor II

Hi, I'm just looking for an easy way to grab the Catalog Pane object and activate it. It seems like there's not an incredibly intuitive way to open or activate it programatically.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can use Pro commands to accomplish this task.  To reuse existing Pro commands (like showing the catalog dockpane or view) you can use the following pattern (copied from a sample button command):

protected override void OnClick()
{
  ExecuteProCommand("esri_core_showProjectView");
  ExecuteProCommand("esri_core_showProjectDockPane");
}


/// <summary>
/// Generic implementation of ExecuteCommand to allow calls to 
/// execute any Pro command / tool by using its Id
/// </summary>
/// <param name="proPluginId">Pro ID (command/tool) to run</param>
/// <returns></returns>
private static void ExecuteProCommand(string proPluginId)
{
  var command = FrameworkApplication.GetPlugInWrapper(proPluginId) as ICommand;
  if (command == null || !command.CanExecute(null)) return;
  command.Execute(null);
}

 Here is some documentation on this subject:  https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Reusing-Pro-Commands 

View solution in original post

2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can use Pro commands to accomplish this task.  To reuse existing Pro commands (like showing the catalog dockpane or view) you can use the following pattern (copied from a sample button command):

protected override void OnClick()
{
  ExecuteProCommand("esri_core_showProjectView");
  ExecuteProCommand("esri_core_showProjectDockPane");
}


/// <summary>
/// Generic implementation of ExecuteCommand to allow calls to 
/// execute any Pro command / tool by using its Id
/// </summary>
/// <param name="proPluginId">Pro ID (command/tool) to run</param>
/// <returns></returns>
private static void ExecuteProCommand(string proPluginId)
{
  var command = FrameworkApplication.GetPlugInWrapper(proPluginId) as ICommand;
  if (command == null || !command.CanExecute(null)) return;
  command.Execute(null);
}

 Here is some documentation on this subject:  https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Reusing-Pro-Commands 

UmaHarano
Esri Regular Contributor

Here is another way to get the Catalog Pane,  selected items:

 

//Get the catalog pane
ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetCatalogPane();
//Get the selected items from the catalog pane:
var items = projectWindow.SelectedItems();
//or get the active catalog view...
//ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetActiveCatalogWindow();