Select to view content in your preferred language

Add context menu entries to selected objects in the the Attribute pane

1865
7
03-08-2021 04:45 PM
MichaelHirschheimer
Esri Contributor

Pro 2.7

I'm looking to add new context menus when a user right clicks on a selected feature in the Attributes pane.

ArcGIS Pro -  Attribute Pane.jpg

 


The Pro SDK Developer sample, InsertIntoContextMenu, is where I started but I'm getting stuck figuring out the RefID for the objects in the attribute pane.

I've searched the Editing.DAML but I'm not entirely sure what to look for.

I'm working with the Utility Network so the selected features could be either Spatial (red arrow) or Non-spatial (purple arrow) objects. 

Any help on how to find the appropriate RefIDs would be greatly appreciated.

Thanks,

Mike

7 Replies
KirkKuykendall1
Frequent Contributor

If you check the "show command IDs" in the Options dialog...

KirkKuykendall1_1-1615262909012.png

 

... Pro should display the ID of the contextmenu items when you hover on them.

 

KirkKuykendall1_0-1615262812797.png

Unfortunately it doesn't seem to tell you the contextmenu IDs (I wish it did).

I think you'll be updating esri_mapping_layerContextMenu or

esri_mapping_standaloneTableContextMenu (for non-spatial).

 

0 Kudos
MichaelHirschheimer
Esri Contributor

Hi Kirk,

I completely agree that the IDs of Context Menus should be displayed when hovering over them.

To find the correct Context Menus, here were my steps.

  1. Got the ID of a button in the context menu
  2. Opened the editing.daml file (C:\Program Files\ArcGIS\Pro\bin\Extensions\Editing)
  3. Searched for all instances the button ID
  4. For each Menu item, I compared the entries to what I was seeing in Pro.EditingDaml.JPG

 

 

I found 3 instances where the new context menu item will be useful

1.  esri_editing_Attributes_RelatedNonFeatureRowContextMenu

2.  esri_editing_Attributes_NonFeatureRowContextMenu

3.  esri_editing_Attributes_TableContextMenu

 

I'll be upadating my Config.daml file later today.  Hopefully, this works!

 

0 Kudos
newbiedotnetguy
Emerging Contributor

@MichaelHirschheimer can u tell me how u added the menu in the context menu of the attribute pane when clicking on the feature?

 

https://community.esri.com/t5/arcgis-pro-sdk-questions/add-context-menu-to-specific-selected-objects...

0 Kudos
MichaelHirschheimer
Esri Contributor

@newbiedotnetguy 

Look at the Pro SDK developer sample, InsertIntoContextMenu. Specifically, the config.daml file.

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/InsertIntoContextMenu

 

To add a custom button to the attribute pane, you'll need to update an existing menu in the module, esri_editing_EditingModule.  Here's an example.  Hope this helps!

<updateModule refID="esri_editing_EditingModule">
      <menus>
        <!-- Drill down from the spatial feature to the Non Spatial object for the Context Menu Item to appear  -->
        <updateMenu refID="esri_editing_Attributes_RelatedNonFeatureRowContextMenu">
          <insertButton refID="InsertIntoContextMenu_Button1" separator="true" placeWith="esri_editing_Attributes_StandaloneTablePropertiesContextMenuItem" />
        </updateMenu>
        <!-- 2 Step Process:  1.  The Non Spatial object must be checked in the Attribute Editor
                              2.  A new entry is added at bottom of the Attribute Tree.  
                                    Right Click on that entry for the Context Menu Item to appear  -->
        <updateMenu refID="esri_editing_Attributes_NonFeatureRowContextMenu">
          <insertButton refID="InsertIntoContextMenu_Button2" separator="true" placeWith="esri_editing_Attributes_StandaloneTablePropertiesContextMenuItem" />
        </updateMenu>
        <updateMenu refID="esri_editing_Attributes_FeatureContextMenu">
          <insertButton refID="InsertIntoContextMenu_Button3" separator="true" placeWith="esri_editing_Attributes_LayerPropertiesContextMenuItem" />
        </updateMenu>
      </menus>
    </updateModule>

 

0 Kudos
newbiedotnetguy
Emerging Contributor

Ya I also got the solution. But in your case are u accessing the name of the feature when right clicking on it. Because when I am right clicking on it I want to check for specific feature and then only want to show the menu item. I am able to access the attribute dock pane but not able to get the selection items since it is in private attribute view model class.

var pane = FrameworkApplication.DockPaneManager.Find("esri_editing_AttributesDockPane");

var viewModel = pane as ArcGIS.Desktop.Editing.Attributes.AttributesViewModel; //Error

 

@MichaelHirschheimer 

0 Kudos
MichaelHirschheimer
Esri Contributor

@newbiedotnetguy   If I'm understanding this correctly, you are looking for similar functionality described in this thread:  

https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieve-feature-attributes-from-the-attribut...

If the answer is yes, I can get a status update on the enhancement request from that thread.

 

 

 

0 Kudos
newbiedotnetguy
Emerging Contributor

yes its the same.

0 Kudos