Select to view content in your preferred language

How to create a new feature doing a copy/paste from another feature?

375
1
07-24-2012 12:00 PM
JoseSanchez
Frequent Contributor
Hi all

In silverling how can I create a new polygon feature copy/pasting one or several existing properties (polygons).

The goal is to allow an end user to creaet a new project selecting an area covered by one or several properties.

In ArcMap it is really easy, but how can I do that with silverlight?
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You would need to create another Graphic that clones original Graphic's geometry and copies original Graphic's Attributes.

For example, you can subscribe to the source layer's MouseLeftButtonDown

  private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
  {
   var l = MyMap.Layers["DestinationLayer"] as GraphicsLayer;
                        // This code clones the geometry (i.e. Polygon)
   var g = new Graphic() { Geometry = Geometry.Clone(e.Graphic.Geometry) };
                       // This code clones the attributes.
   foreach (var item in g.Attributes)
    g.Attributes[item.Key] = item.Value;
   l.Graphics.Add(g);
  }
0 Kudos