1

I am new to pro SDK. I am trying to add a button to a menu which will do the identical function to the copy coordinates command:

enter image description here

and then I would run further code when I get those coordinates in the clipboard.

I would assume the code for the button function would look something similar to this:

internal class MyButton : Button
{
    protected override void OnClick()
    {
        protected internal virtual Func<Task> ExecuteCommand(string id = "esri_mapping_copyCoordinates");
        //other code goes here
    }
}

This is based on the reference guide: ArcGIS Pro Reference - ExecuteCommand Method

However, this does not seem to compile.

Can anyone help me out with this? Basically, I'm just looking for a code sample on how to run an existing ArcGIS Pro command.

1

1 Answer 1

2

Take a look at this page in the documentation, which shows several different ways of re-using existing ArcGIS Pro Commands:

  • Reusing ArcGIS Pro Commands in your Add-in Ribbon UI by Reference
  • Reusing ArcGIS Pro Commands in your Add-in Ribbon UI in Code-Behind
  • Reusing ArcGIS Pro Commands in MVVM
  • Reusing ArcGIS Pro Commands in MVVM Code-Behind
2
  • Thank you so so much!!! That was exactly what I was looking for!
    – a_uly0003
    Feb 10, 2023 at 22:16
  • Please remember to click the check mark to signify your question was answered. This will help others searching for the same solution.
    – kenbuja
    Feb 13, 2023 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.