How to insert the selection tool in an embeddable control

746
3
Jump to solution
06-01-2021 09:04 AM
Zoggo
by
New Contributor II

I created a custom Tool (Sketch) with a embeddable control and placed it in the esri_editing_CommandList. That works fine so far. Now I'd like to build a similar tool like the split tool. The split tool opens a embedabble control with a select tool inside. Is it possible to insert the existing select command into embedabble control or do I have to write new code from scratch for that?

urs_richard_0-1622563340052.png

 

0 Kudos
1 Solution

Accepted Solutions
NarelleChedzey
Esri Contributor

Hello again, 

Unfortunately I don't think it is currently possible to accomplish what you trying to attempt. 

When I added a button to my embeddable control and activated the rectangle selection tool on the button click, it deactivated my custom Sketch tool and closed the embedded control; reverting the Modify Features pane to the initial state displaying the complete list of sketch tools.  This is not the behavior that is wanted. 

 

As an alternative, are you aware of the UseSelection property within the MapTool class.   When true, it allows your tool to toggle between sketch and selection mode via the SHIFT key.   This is documented here -  https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#useselection

Is this behavior enough for your purposes?  As per the documentation you can also use the ActivateSelectAsync  method to explicitly toggle the tool between sketch and selection mode rather than the default SHIFT key.  You could perhaps tie this a button on the UI. 

The following sample illustrates the concepts of UseSelection and ActivateSelectAsync. 

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/DemoUseSelection

 

Regards

Narelle

 

 

View solution in original post

0 Kudos
3 Replies
NarelleChedzey
Esri Contributor

Hello, 

 

Unfortunately we don't have any public controls or templates that provide the UI and behavior that you see within the Editing tools such as Split with regards to the selection tool dropdown and TreeView showing the selected features. 

You can however certainly add any of the selection tools (rectangle, lasso, etc) into the UI yourself by attaching it to a UI wpf element such as a button.  

I will try and work up a simple example and post here. 

 

Regards

Narelle

0 Kudos
NarelleChedzey
Esri Contributor

Hello again, 

Unfortunately I don't think it is currently possible to accomplish what you trying to attempt. 

When I added a button to my embeddable control and activated the rectangle selection tool on the button click, it deactivated my custom Sketch tool and closed the embedded control; reverting the Modify Features pane to the initial state displaying the complete list of sketch tools.  This is not the behavior that is wanted. 

 

As an alternative, are you aware of the UseSelection property within the MapTool class.   When true, it allows your tool to toggle between sketch and selection mode via the SHIFT key.   This is documented here -  https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#useselection

Is this behavior enough for your purposes?  As per the documentation you can also use the ActivateSelectAsync  method to explicitly toggle the tool between sketch and selection mode rather than the default SHIFT key.  You could perhaps tie this a button on the UI. 

The following sample illustrates the concepts of UseSelection and ActivateSelectAsync. 

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/DemoUseSelection

 

Regards

Narelle

 

 

0 Kudos
Zoggo
by
New Contributor II

Hi Narelle

Thanks for your reply. I think the Solution with the ActiveSelectAsync will work for me. For the future it would be nice to reuse existing Tools in enmbedded controls. I will try your Solution this afternoon.

Regards Urs

0 Kudos