ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Core Namespace / ICatalogWindow Interface / GetCurrentContentType Method
Example

In This Topic
    GetCurrentContentType Method
    In This Topic
    Gets the current catalog content type being shown in the catalog dock pane
    Syntax
    CatalogContentType GetCurrentContentType()
    Function GetCurrentContentType() As CatalogContentType
    Example
    Get the catalog content type currently being shown
    //Gets the Catalog pane
    var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
    var catContentType = catalogWindow.GetCurrentContentType();
    Set the catalog content type
    //Gets the Catalog pane
    var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
    if (!catalogWindow.IsActiveWindow)
        return; //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);
    Set the secondary portal catalog content
    //Gets the Catalog pane
    var catalogWindow = Project.GetCatalogPane() as ICatalogWindow;
    if (!catalogWindow.IsActiveWindow)
        return; //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);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also