void MyMap_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { var l = MyMap.Layers["Drawing Layer"] as GraphicsLayer; if (l != null) { var graphic = l.Graphics.LastOrDefault(g => g.Geometry != null); if (graphic != null) l.Graphics.Remove(graphic); //check if this returns true/false. } } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.