Select to view content in your preferred language

How to Access the Selected Table or Feature Class in the Catalog Pane Context Menu (ArcGIS Pro Add-in)?

149
2
Jump to solution
Sunday
IhabHassan
Esri Contributor

This is for ArcGIS Pro add-in development using Csharp .NET.
What is the 
public, supported way to access the selected or right-clicked table or feature class in the Catalog pane from a context menu button?

  • Is there a public API to retrieve the selected item(s) in the Catalog pane context menu handler?
  • Are there any best practices or workarounds for obtaining the path or reference to the right-clicked item?
  • Internal interfaces like ICatalogPane and IProjectWindow are not accessible—are there alternatives?

Any guidance or code samples would be appreciated. Thank you!

Regards
Ihab
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

You can access them from Catalog pane :

        protected override void OnClick()
        {
            var catalog = Project.GetCatalogPane();
            var items = catalog.SelectedItems;
            var item = items.OfType<ProGPXItem>().FirstOrDefault();
            if (item == null)
                return;
            MessageBox.Show($"Selected Custom Item: {item.Name}");
        }

Change items.OfType object type <T> to your needs or use without <T>

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You can access them from Catalog pane :

        protected override void OnClick()
        {
            var catalog = Project.GetCatalogPane();
            var items = catalog.SelectedItems;
            var item = items.OfType<ProGPXItem>().FirstOrDefault();
            if (item == null)
                return;
            MessageBox.Show($"Selected Custom Item: {item.Name}");
        }

Change items.OfType object type <T> to your needs or use without <T>

IhabHassan
Esri Contributor

thanks @GKmieliauskas , that worked nicely 

Regards
Ihab
0 Kudos