Creating Polygon at runtime using mouse clicks

731
3
04-23-2021 03:57 PM
ManishShrivastav
New Contributor III

Hi,

I am trying to draw a polygon on the fly in a map view. Is there any tool available in arcgis runtime sdk for .net (using 100.9.0).

I am using https://developers.arcgis.com/net/wpf/sample-code/cut-geometry/ as a sample, but instead of providing MapPoints() as coordinates in code file, I want to register the mouse click at runtime and use those clicks as input points to draw a polygon on the MapView.

Your help is greatly appreciated.

Thanks,

Manish

0 Kudos
3 Replies
JoeHershman
MVP Regular Contributor

To draw a shape based on user input you use the SketchEditor.StartAsyn method.  There is a simple example shown on the help page

https://developers.arcgis.com/net/wpf/api-reference/html/M_Esri_ArcGISRuntime_UI_SketchEditor_StartA...

 

ManishShrivastav
New Contributor III

Thanks for pointing out the resource but after creating the polygon according the resource I am not able to conduct any kind of geoprocessing on it. It is just like a graphic on my map. Please let me know if there is anything I am missing.

Thanks

0 Kudos
JoeHershman
MVP Regular Contributor

The SketchEditor simply creates a geometry.  If you want a feature you will need to create a feature set the geometry and then add that to the table

0 Kudos