ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Core Namespace / IProjectWindow Interface / SelectItemAsync Method
The Item to select or unselect
Select or unselect the item
True to expand the parent container to show the selection
Optionally specify the parent container you want to find the Item in
Example

In This Topic
    SelectItemAsync Method
    In This Topic
    Select an Item
    Syntax
    Task SelectItemAsync( 
       Item Item,
       bool select,
       bool expand,
       Item container
    )
    Function SelectItemAsync( _
       ByVal Item As Item, _
       ByVal select As Boolean, _
       ByVal expand As Boolean, _
       ByVal container As Item _
    ) As Task

    Parameters

    Item
    The Item to select or unselect
    select
    Select or unselect the item
    expand
    True to expand the parent container to show the selection
    container
    Optionally specify the parent container you want to find the Item in
    Example
    Select an item in the Catalog pane
    //Get the catalog pane
    ArcGIS.Desktop.Core.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
    projectWindow.SelectItemAsync(toolbox, true, true, null);//null selects it in the first container - optionally await
                                                             //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)
    projectWindow.SelectItemAsync(toolbox, true, true, foldersContainer);//optionally await
    
    //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, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also