Select to view content in your preferred language

Editor Widget Confirm Delete

2073
2
02-03-2011 11:27 AM
DarellStoick
Occasional Contributor
I'm using the Silverlight Editor widget similar to the sample at [HTML]http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave[/HTML] and would like to add a confirmation before delete.

How would you go about that using this format

<Button x:Name="DeleteButton" Margin="2"                          
      Command="{Binding DeleteSelected}">
     <TextBlock>Delete<LineBreak/>Selected</TextBlock>
</Button>

Is there a way to call the DeleteSelected from codebehind using the ESRI.ArcGis.Client.Editor Class
in the button click event

Thanks
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Sure. Instead of setting Command property on the Button, you can add a Click event handler that will call DeleteSelected command.

private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
 var result = MessageBox.Show("Confirm delete?", "Delete", MessageBoxButton.OKCancel);
 Editor editor = LayoutRoot.Resources["MyEditor"] as Editor;
 if (result == MessageBoxResult.OK)
 {
  if (editor.DeleteSelected.CanExecute(null))
   editor.DeleteSelected.Execute(null);
 }
}
0 Kudos
DarellStoick
Occasional Contributor
Works great, Thanks
0 Kudos