ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping.Events Namespace / SketchModifiedEventArgs Class / CurrentSketch Property
Example

In This Topic
    CurrentSketch Property
    In This Topic
    The current sketch geometry.
    Syntax
    public Geometry CurrentSketch {get;}
    Public ReadOnly Property CurrentSketch 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, Windows 8.1

    See Also