AnsweredAssumed Answered

Unselect ArcGIS Pro MapTool Programmatically

Question asked by danielri on Nov 4, 2016

Hello,

 

I have a custom MapTool Add-in created in C# for ArcGIS Pro 1.3.1. The tool works and allows me to click on the map, obtain a point, and do some work with it and display the results in a Windows Form. However the tool stays selected in the ribbon. I would like to unselect the tool in the ribbon after the user clicks on the map so it is not highlighted in the interface (i.e., blue background shows on tool in the ribbon) and the

System.Windows.Forms.Cursor.goes back to a default ArcGIS Pro cursor -e.g., used for pan and zoom.

 

Here is the DAML defining the tool:

<tool id="StreetView_Core" caption="StreetView" className="StreetView" loadOnClick="true" smallImage="Images\GenericButtonRed16.png" largeImage="Images\GenericButtonRed32.png" condition="esri_mapping_mapPane" keytip="StreetView">

<tooltip heading="StreetView">StreetView Tool<disabledText /></tooltip>

</tool>

 

This is my class:

 

internal class StreetView : MapTool

 

I've tried this but it does not have any effect.

 

protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e)

{

 if (e.ChangedButton == System.Windows.Input.MouseButton.Left)

   {

   var mapView = MapView.Active;

   if (mapView != null)

         {

      ActivateSelectAsync(false);

      }

   }

}

 

Another option would be to programmatically change to another tool.

 

Rich D.

Outcomes