Switch to pan mode when using editor

1990
2
09-15-2011 12:29 AM
De_WetEllis
New Contributor III
Hi

How can switch back to pan mode when using the Esri:Editor.

When the user enables selection on my custom tool a feature layer is added according to the Layer selected. When the user has finished selecting features the selected features are sent back to the web browser by clicking on a submit button. How can I enable the pan mode when the user has finished selecting the features.

I dont want to disable the ContinuousMode because the user needs to be able to select multiple features without having to keep on clicking the add button. The ContinuousMode when disabled after a few features has been selected still requires a last action to be performed before the Action is canceled.

I was hoping to revert to pan mode when the user clears the selected features or on submit when sending the data back to the web page.

Thanks

De Wet
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Are you using EditorWidget http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitEditorWidget or Editor http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave?

Either way, you can wire up to EditCompleted (applicable to both EditorWidget and Editor) and only call Cancel for other commands so Add may remain Continuous=True.
void EditorWidget_EditCompleted(object sender, Editor.EditEventArgs e)
{
 if (e.Action != Editor.EditAction.Add || e.Action != Editor.EditAction.Cancel)
 {
  Editor editor = null;
  if (sender is EditorWidget)
   editor = (sender as EditorWidget).DataContext as Editor;
  else
   editor = sender as Editor;
  if (editor != null && editor.CancelActive.CanExecute(null))
   editor.CancelActive.Execute(null);
 }
}
0 Kudos
De_WetEllis
New Contributor III
Hi Jennifer

Worked like a charm .

Thanks

De Wet
0 Kudos