ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Mapping.Events Namespace / SketchModifiedEventArgs Class / PreviousSketch Property
Example

In This Topic
    PreviousSketch Property
    In This Topic
    Gets the sketch geometry before the modification.
    Syntax
    public Geometry PreviousSketch {get;}
    Public ReadOnly Property PreviousSketch As Geometry
    Example
    Listen to the sketch modified event
    // SketchModified event is fired by 
    //  - COTS construction tools (except annotation, dimension geometry types), 
    //  - Edit Vertices, Reshape, Align Features
    //  - 3rd party tools with FireSketchEvents = true
    
    
    //Subscribe the sketch modified event
    //ArcGIS.Desktop.Mapping.Events.SketchModifiedEvent.Subscribe(OnSketchModified);
    
    private void OnSketchModified(ArcGIS.Desktop.Mapping.Events.SketchModifiedEventArgs args)
    {
      // if not an undo operation
      if (!args.IsUndo)
      {
        // what was the sketch before the change?
        var prevSketch = args.PreviousSketch;
        // what is the current sketch?
        var currentSketch = args.CurrentSketch;
        if (currentSketch is Polyline polyline)
        {
          // Examine the current (last) vertex in the line sketch
          var lastSketchPoint = polyline.Points.Last();
    
          // do something with the last point
        }
      }
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also