public static class RowDeletedEvent
Public MustInherit NotInheritable Class RowDeletedEvent
public static class RowDeletedEvent
Public MustInherit NotInheritable Class RowDeletedEvent
If you need to edit additional tables within the RowEvent you MUST use the ArcGIS.Core.Data API to edit the tables directly. Do NOT use a new edit operation to create or modify features or rows in your RowEvent callback.
protected void SubscribeRowEvent() { QueuedTask.Run(() => { //Listen for row events on a layer var featLayer = MapView.Active.GetSelectedLayers().First() as FeatureLayer; var layerTable = featLayer.GetTable(); //subscribe to row events var rowCreateToken = RowCreatedEvent.Subscribe(OnRowCreated, layerTable); var rowChangeToken = RowChangedEvent.Subscribe(OnRowChanged, layerTable); var rowDeleteToken = RowDeletedEvent.Subscribe(OnRowDeleted, layerTable); }); } protected void OnRowCreated(RowChangedEventArgs args) { } protected void OnRowChanged(RowChangedEventArgs args) { } protected void OnRowDeleted(RowChangedEventArgs args) { }
public static void StopADelete() { // subscribe to the RowDeletedEvent for the appropriate table Table table = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault().GetTable(); RowDeletedEvent.Subscribe(OnRowDeletedEvent, table); } private static void OnRowDeletedEvent(RowChangedEventArgs args) { // RowEvent callbacks are always called on the QueuedTask so there is no need // to wrap your code within a QueuedTask.Run lambda. var row = args.Row; // cancel the delete if the feature is in Police District 5 var fldIdx = row.FindField("POLICE_DISTRICT"); if (fldIdx != -1) { var value = row[fldIdx].ToString(); if (value == "5") { //cancel with dialog // Note - feature edits on Hosted and Standard Feature Services cannot be cancelled. args.CancelEdit("Delete Event\nAre you sure", true); // or cancel without a dialog // args.CancelEdit(); } } }
System.Object
ArcGIS.Desktop.Editing.Events.RowDeletedEvent
Target Platforms: Windows 11, Windows 10