MapTool.OnSelectionChangedAsync not triggered

334
1
08-04-2022 03:53 PM
GiacomoGasco
New Contributor II

Hello,

on a custom Tool that extend the MapTool class.

When MapTool.UseSelection is true

If the selection is done while the sketch tool is active, so you are drawing lines, the MapTool.OnSelectionChangedAsync isn't triggered.

Is it possibile, is it correct?

Thank you,

Giacomo

Tags (1)
0 Kudos
1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

When MapTool.UseSelection is true and your MapTool does sketching (i.e. i used SketchType = SketchGeometryType.Line in my sample), you can start sketching and the sketch (in progress) is saved as soon as you hold down the SHIFT key.  Here i am digitizing my line sketch:

Wolf_0-1659977642613.png

Then i hold down my Shift Key and the Sketch state is preserved.  Note that the sketching toolbar disappears as soon as you hold down the Shift key.  Now with the Shift Key down i am in selection mode and i can now select different features (selection by Rectangle):

Wolf_1-1659977715194.png

When i finish any selection (by finishing the rubberband selection with the shift key still down) the OnSelectionChangedAsync method is called with the MapSelectionChangedEventArgs parameter showing the change in selection.

Once i let the Shift key go, the Sketch state is restored and i can resume sketching where i left off before i held down the Shift key.  The sketch tool bar also reappears.

Wolf_2-1659977921998.png

 

0 Kudos