Select to view content in your preferred language

How to stop Editor.EditVertices

648
3
12-10-2010 01:01 PM
DonnieHolmes
Occasional Contributor
I am using the Editor.Editvertices icommand to edit a GraphicLayer (not a FeatureLayer). I would like to add functionality to allow the user to stop editing the current graphic by pressing a specific key. It seems like the only way to get the editvertices command to end (while keeping edits to the graphic) is to click on another map feature, and this is less than intuitive.

Basically, what i'm looking for is something similar to the Draw.CompleteDraw method. This method allowed me to implement a key press handler to signal that the drawing is complete.

Any ideas?
Thanks.
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
Are you using API v2.1?

The Editor has a CancelActive command. If EditVertices is active and the edit on the geometry is not yet finalized, when CancelActive command is executed, the geometry isrolled back to its original form.

You can try it out here: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave. The same thing applies for GraphicsLayer.

If you need to call CancelActive in code-behind, say on KeyDown event:
if (this.editor.CancelActive.CanExecute(null))
                this.editor.CancelActive.Execute(null);


There is also an EditCompleted event in the Editor.
0 Kudos
DonnieHolmes
Occasional Contributor
Are you using API v2.1?

The Editor has a CancelActive command. If EditVertices is active and the edit on the geometry is not yet finalized, when CancelActive command is executed, the geometry isrolled back to its original form.

You can try it out here: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave. The same thing applies for GraphicsLayer.

If you need to call CancelActive in code-behind, say on KeyDown event:
if (this.editor.CancelActive.CanExecute(null))
                this.editor.CancelActive.Execute(null);


There is also an EditCompleted event in the Editor.


What i need is a way to finalize the edit (and keep the changes) rather than cancel. Here's the workflow I have set up for my users:

  1. Hover over feature and get my maptip which has an "edit vertices" command button

  2. User clicks the button and i pass in the graphic as the argument for the editvertices command.

  3. User makes edits to the geometry of the graphic

  4. To stop editing the vertices the user has to click on another feature?. I would rather give them a "complete" hotkey to use (I already have a "cancel" hotkey that uses the CancelActive that you mentioned).


  5. Thanks for the help.
0 Kudos
JenniferNery
Esri Regular Contributor
Hmm.. EditVertices as it is designed right now is only completed when you click the same feature or another feature. It is more interactive. We don't currently have a public method that you can call to complete the edit. I'll share your use case with the rest of the team and take it into advisement.
0 Kudos