Hi,
I am struggling with activating a new MapTool item (point sketching on amap) from a button located in a custom Dockpane. Can you please direct me to some code samples or resources on how to do that?
Thanks!
adam
Solved! Go to Solution.
When you implement a button (or tool) you have to define its 'id' in the config.daml file. Usually the item template for buttons/tools will define an id for you. It looks like this:
<tool id="CompReporter_AddCompBySelection" caption="AddCompBySelection"
className="AddCompBySelection" loadOnClick="true" ...>
<tooltip ... </tooltip>
</tool>
the 'id' in this case is: CompReporter_AddCompBySelection
In the 'code behind' for your dockpane you can then use your tool (or button) just like any other ArcGIS Pro button (built-in or not) by using this snippet:
// use CompReporter_AddCompBySelection
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("CompReporter_AddCompBySelection");
if (wrapper is ICommand toolCmd)
{
// if it is a tool, execute will set current tool
toolCmd.Execute(null);
}
Hi Gintautas,
Thank you for the answer. I believe that the link you mentioned is useful only to activate arcgis pro built-in MapTools. Is it correct?
Thanks!
Adam
Hi,
If I understand your question right then you can activate Esri, your or third-party tools the same way. As described in link. One thing which you need to know it is tool ID. Here is link for Esri tools ID:
https://github.com/Esri/arcgis-pro-sdk/wiki/ArcGIS-Pro-DAML-ID-Reference
If you can find Esri sketch tool which is useful for your workflow you can activate it. Otherwise your can create your own sketch tool.
Here is the link to related thread:
When you implement a button (or tool) you have to define its 'id' in the config.daml file. Usually the item template for buttons/tools will define an id for you. It looks like this:
<tool id="CompReporter_AddCompBySelection" caption="AddCompBySelection"
className="AddCompBySelection" loadOnClick="true" ...>
<tooltip ... </tooltip>
</tool>
the 'id' in this case is: CompReporter_AddCompBySelection
In the 'code behind' for your dockpane you can then use your tool (or button) just like any other ArcGIS Pro button (built-in or not) by using this snippet:
// use CompReporter_AddCompBySelection
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("CompReporter_AddCompBySelection");
if (wrapper is ICommand toolCmd)
{
// if it is a tool, execute will set current tool
toolCmd.Execute(null);
}
Thank you @Wolf and @GintautasKmieliauskas for the guidance. It works ok now.