I need to create a custom polygon select tool in Pro that has the same behavior as the default rectangle select tool in ArcGIS Pro. The default behavior is the if you click once, the polygon will be selected (multiple polygons with Shift key pressed down); if you click and drag, you select by rectangle. (Similar to the old IRubberBand in Arc Objects). I cannot figure out how to emulate this behavior using the Pro SDK. I’ve developed a custom point select tool with the Shift multi select behavior using
SketchType = SketchGeometryType.Point;
public bool IsShiftKey()
{
return (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift));
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
Key keyboardKey = Key.None;
if(IsShiftKey())
{
keyboardKey = Key.LeftShift;
}
SIPAS.Events.SketchGeometryUpdatedEvent.Publish(new SIPAS.Events.SketchGeometryUpdatedEventArgs(this, geometry, keyboardKey));
return base.OnSketchCompleteAsync(geometry);
}
But this does not let you select by rectangle by dragging. If I use
SketchType = SketchGeometryType.Rectangle;
I cannot multiselect by click or Shift click. I have to click twice to create a rectangle to select a single polygon (which my customer is highly annoyed by).
How can I create a custom select tool that has the same behavior as the default Pro select tool on the Edit tab/ribbon?