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
}
}
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.