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.
Solved! Go to Solution.
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
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
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();