I am writing some code to implement some poor man's snapping while sketching graphics on the map. I've got it working quite nicely for snapping points to lines. I'm now coding the reverse and have been unable to modify the location of a vertex on the fly while I'm digitizing a polyline.
I'm attempting to do all this snap stuff in the SketchEditor_GeometryChanged event. I get the point/vertex that was just drawn and I'm able to run my snap code to get the new point location. I then use a PolylineBuilder to set that point to the new snapped location. I then use SketchEditor.ReplaceGeometry to replace the current sketch geometry with the new polyline from the PolylineBuilder.
After my SetPoint call pb.IsSketchValid = false. The ReplaceGeometry call also returns false. What am I missing?
PolylineBuilder pb = new PolylineBuilder(polyline);
SketchEditor se = (SketchEditor)sender;
bool replace = se.ReplaceGeometry(pb.ToGeometry());