I have a button I created in my tool bar that opens a custom attribute form that I created. I would like to add this button to the right click menu of the selected feature context menu. So when one or more features is selected, and I right click, my Open Attribute Menu item will be on the list. In ArcObjects I was able to do this by adding it to the Command Bar for the Edit Tool menu. I was hoping that it would be this simple in ArcGIS Pro, or if I was able to do this in the DAML somehow. My initial efforts or simply adding a menu in the DAML and setting ContextMenu="True" and adding my button reference did not work. But i feel like I am missing something that might make this process quite easy as I do see contextMenu in the xsd for ArcGIS.Desktop.Framework.
Yes this is done through the DAML.
Take a look at the Restart Sketch sample where I'm inserting a button into the sketch context menu in the config.daml file.
The only trick is finding out the daml of the context menu you want to insert it into. For the selection context menu take a look at the mapping daml id references and search for selection. There's a few.
Here is the DAML code (add to your config.daml file in your add-in) to insert into Pro's Selection context menu. As Sean mentioned, the DAML ids can be found in the ArcGIS DAML reference page on the SDK wiki.
<!--Note: "updateModule" tag should be within the "modules" tag-->
<!--This is the DAML ID of Pro context menu -->
<!--SelectedFeatureContextMenu_Open_Attribute_Menu is a button control that must exist within the controls tag-->
I must be missing something. I can't even add an ESRI reference to the Context menu, let alone my own button. This should put the save button in the context menu for the Selection
<insertButton refID="esri_core_saveProjectButton" placeWith="esri_mapping_locateReverseGeocode" />
The DAML looks correct. I was able to copy your daml snippet into an add-in. I now see the Save button in the context menu for the selection.
Perhaps check if the add-in is being loaded correctly by Pro using the Add-in Manager?
I am actually using a configuration not an addin. So maybe that has something to do with it? Do I need to make sure something loads that is not. Right now my configuration only loads a small subset of all of the Pro Tools.
Looks like this is a bug. I was able to see your problem in a Configuration.
As a workaround, I was able to modify the context menu by using the OnCreateDAML override of the ConfigurationManager class.
So how is that accomplished. Do I have to Navigate the database elements and add the element to the esri_mapping_selection2DContextMenu somehow? Or can i reload the .daml here somehow?
So for a Configuration I had to do a work around to replace and add an item to the esri_mapping_selection2DContextMenu selection menu. I did this in the OnUpdateDatabase Override function of my ConfigurationManager.cs file. The RefID to my attribute editor, MyAttributeEditor, is set up in the config.daml controls section. But I had to add it here. The following worked for me to remove and add, but I would like to know how to use the OnCreateDaml override if possible.
protected override void OnUpdateDatabase(XDocument database)
// select all elements that are tabs
var nasp = database.Root.Name.Namespace;
var menuElements = from seg in database.Root.Descendants(nasp + "menu") select seg;
foreach (var menuElement in menuElements)
var id = menuElement.Attribute("id");
if (id != null && id.Value.StartsWith("esri_mapping_selection2DContextMenu"))
//Remove the OOB Attribute Editor Item
var buttonElements = from seg in menuElement.Descendants(nasp + "button") select seg;
foreach (var butElement in buttonElements)
var refID = butElement.Attribute("refID");
if (refID != null && refID.Value.StartsWith("esri_editing_ShowAttributes"))
//Add My Attribute Editor
XElement xe = new XElement("button");
XAttribute attRefID = new XAttribute("refID", "MyAttributeEditor");
XAttribute attSeparator = new XAttribute("separator", "true");
XAttribute attInsert = new XAttribute("insert", "after");
Here is a sample configuration solution that will help. I have created a resource called OnCreateDaml.txt in the attached solution. This txt file is the DAML that will be loaded by Pro when you run the Configuration. In this text file, I have the updateModule snippet like before. This gets returned by the OnCreateDaml override to the Pro Framework.
protected override string OnCreateDaml()