This is .Net (Silverlight) program. I want to add a Graphic item to a GraphicsLayer. The related code is listed below
GraphicsLayer newGLyr = new GraphicsLayer();
for (int i = 0; i < gLayer.Graphics.Count; i++) {
Graphic g = gLayer.Graphics;
if (!isDuplicate(newGLyr, g))
newGLyr.Graphics.Add(g);
}
However, I got the runtime error:
Specified argument was out of the range of valid values. Parameter name: Graphic is already associated with another layer.
How can this be fixed? Thanks.