How to retrieve geometric shapes SketchEditor from GraphicsOverlay object

09-15-2020 07:38 AM
New Contributor III


How to retrieve geometric shapes SketchEditor names from  GraphicsOverlay object ?

In SketchCreationMode I have Circle, Rectangle, etc.. type name.

I make shapes with SketchEditor.

I would like retrieve geometric shapes names from GraphicsOverlay object. It's possible?

I would like to have "Rectangle", "Circle", etc.. name.

Because when I try with GraphicsOverlay, I have only, "Polygon" or "Polyline" name.


0 Kudos
2 Replies
Esri Contributor

Hi Cavron. The geometry created by SketchEditor is created as Polygons, Points, or Polylines. If you want to keep the shape name, you can store the name as an attribute of the graphic.

This is modified code for the Sketch on map sample.

// Let the user draw on the map view using the chosen sketch mode
SketchCreationMode creationMode = (SketchCreationMode)SketchModeComboBox.SelectedItem;
Esri.ArcGISRuntime.Geometry.Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, true);

// Create and add a graphic from the geometry the user drew
Graphic graphic = CreateGraphic(geometry);

// Add the sketch creation mode as an attribute of the graphic.
graphic.Attributes["SketchCreationMode"] = Enum.GetName(typeof(SketchCreationMode), creationMode);

// Add the graphic to your graphics overlay.

Later, you can get the "Rectangle" name from the graphics attributes.

I hope this helps,


New Contributor III

Hi Zack,

Thank you for your answer. I will test.

0 Kudos