Parameters
- index
- The index of the field.
Return Value
The value of the field.
| Exception | Description |
|---|---|
| System.ArgumentException | The index argument is out of range. |
| ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
| ArcGIS.Core.Geometry.Exceptions.GeometryException | index corresponds to a shape field index and the type of shape (i.e., geometry) is not supported. |
// Set up a listener for row change events on the table associated with the // provided feature layer. The event subscription occurs within a queued task to ensure thread safety. await QueuedTask.Run(() => { //Listen to the RowChangedEvent that occurs when a Row is changed. var modifiedFeatureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(); ; RowChangedEvent.Subscribe(rowChangedEventArgs => { // RowEvent callbacks are always called on the QueuedTask so there is no need // to wrap your code within a QueuedTask.Run lambda. //Get the layer's definition var lyrDefn = modifiedFeatureLayer.GetFeatureClass().GetDefinition(); //Get the shape field of the feature class string shapeField = lyrDefn.GetShapeField(); //Index of the shape field var shapeIndex = lyrDefn.FindField(shapeField); //Original geometry of the modified row var geomOrig = rowChangedEventArgs.Row.GetOriginalValue(shapeIndex) as Geometry; //New geometry of the modified row var geomNew = rowChangedEventArgs.Row[shapeIndex] as Geometry; //Compare the two bool shapeChanged = geomOrig.IsEqual(geomNew); if (shapeChanged) { // The geometry has not changed Console.WriteLine("Geometry has not changed"); } else { // The geometry has changed Console.WriteLine("Geometry has changed"); } }, modifiedFeatureLayer.GetTable()); });
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)