In This Topic
Gets the catalog dockpane. If createIfNecessary = true and the catalog dockpane has not been created, the pane will be created. Otherwise, if the catalog dockpane has not been created and createIfNecessary = false, null will be returned.
Syntax
Parameters
- createIfNecessary
- true (default) to create the dockpane if it has not already been created
Return Value
An IProjectWindow for the catalog dockpane or null.
Example
Set the catalog dockpane as the active window
{
//cast ICatalogWindow to ArcGIS.Desktop.Framework.Contracts.DockPane
var catalogWindow = Project.GetCatalogPane() as DockPane;
//Activate it
catalogWindow.Activate();
}
Check if the Catalog Window is the active window
{
var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
if (catalogWindow.IsActiveWindow)
{
//TODO - query/change catalog window content
}
}
Get the catalog content type currently being shown
{
//Gets the Catalog pane
var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
var catContentType = catalogWindow.GetCurrentContentType();
// use catContentType;
}
Set the catalog content type
{
//Gets the Catalog pane
var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
if (!catalogWindow.IsActiveWindow)
{
//catalog dockpane must be the active window
}
//Change the content to whatever is the next tab
var catContentType = (int)catalogWindow.GetCurrentContentType();
catContentType++;
if (catContentType > (int)CatalogContentType.Favorites)
{
catContentType = (int)CatalogContentType.Project;
}
//Must be on the UI - no QueuedTask!
catalogWindow.SetContentTypeAsync((CatalogContentType)catContentType);
}
Get the secondary portal catalog content
{
//Gets the Catalog pane
var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
var catContentType = catalogWindow.GetCurrentContentType();
//Is Portal the content type?
if (catContentType == CatalogContentType.Portal)
{
//check what is the portal content type being shown...
var secondaryContentType =
catalogWindow.GetCurrentSecondaryPortalContentType();
//TODO use secondary portal content type...
}
}
Set the secondary portal catalog content
{
//Gets the Catalog pane
var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
if (!catalogWindow.IsActiveWindow)
{
//catalog dockpane must be the active window
}
var catContentType = catalogWindow.GetCurrentContentType();
//Is portal content being shown?
if (catContentType == CatalogContentType.Portal)
{
//check what is the portal content type being shown...
var portalContentType = (int)catalogWindow.GetCurrentSecondaryPortalContentType();
//advance to the next tab
portalContentType++;
if (portalContentType > (int)CatalogSecondaryPortalContentType.LivingAtlas)
{
portalContentType = (int)CatalogSecondaryPortalContentType.UserContent;
}
//set the secondary portal content type
//Must be on the UI - no QueuedTask!
catalogWindow.SetSecondaryPortalContentTypeAsync(
(CatalogSecondaryPortalContentType)portalContentType);
}
}
Select an item in the Catalog pane
{
//Get the catalog pane
IProjectWindow projectWindow = Project.GetCatalogPane();
//or get the active catalog view...
//ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetActiveCatalogWindow();
//eg Find a toolbox in the project
string gpName = "Interacting with Maps.tbx";
var toolbox = Project.Current.GetItems<GeoprocessingProjectItem>().FirstOrDefault(tbx => tbx.Name == gpName);
//Select it under Toolboxes
await projectWindow.SelectItemAsync(toolbox, true, true, null);//null selects it in the first container
//Note: Project.Current.GetProjectItemContainer("GP") would get toolbox container...
//assume toolbox is also under Folders container. Select it under Folders instead of Toolboxes
var foldersContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "FolderConnection");
//We must specify the container because Folders comes second (after Toolboxes)
await projectWindow.SelectItemAsync(toolbox, true, true, foldersContainer);
//Find a map and select it
var mapItem = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(m => m.Name == "Map");
//Map only occurs under "Maps" so the container need not be specified
projectWindow.SelectItemAsync(mapItem, true, false, null);
}
Requirements
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)
ArcGIS Pro version: 3.0 or higher.
See Also