Select to view content in your preferred language

Graphic disappear on save edits

695
2
12-20-2011 11:55 PM
Hwee_KiangSim
Emerging Contributor
I am experiencing a strange effect. I have graphics drawn on my graphics layer. I use EditGeometry to edit my graphics.
When I move my vertices during edits, I capture the editgeometry event e.Action. Because I need to get the most updated coordinates, I need to do a StopEdit() in order to commit the changes. But I want the user to be able to continue editing so immediately after StopEdit() I do a StartEdit(e.graphic) again.

By doing this, my graphic seem to disappear every time a double click on it. It will reappear if I zoom out and in again (like a map refresh)

If I comment out the StopEdit and StartEdit it will not disappear but its not my intended behavior to omit these 2 statements.

Is there anything wrong with what I am doing or is there a map refresh function for me to call?

Thanks
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
I assume you have similar code. You can call layer.Refresh() on EditCompleted to cause the graphics to re-draw.
        private void EditGeometry_GeometryEdit(object sender, EditGeometry.GeometryEditEventArgs e)
        {
   if (e.Action == EditGeometry.Action.VextedMoved)
   {
    editGeometry.StopEdit();
    editGeometry.StartEdit(editGraphic);
   }
   else if(e.Action == EditGeometry.Action.EditCompleted)
    layer.Refresh();
        }
0 Kudos
Hwee_KiangSim
Emerging Contributor
Hi Jennifer,

I tried and it works beautifully. Thanks!
0 Kudos