Why would my Graphics shift when changing zoom programmatically?

03-16-2015 04:25 PM
New Contributor III

I have a Silverlight application where I am creating new GraphicsLayers and adding simple line graphics representing line features to each layer. Each individual GraphicLayer will actually have 3 different line styles (solid, dashed, and dotted) included within it depending on the feature type. This works great until I try programmatically zooming to one of the created layers. The way I'm approaching the zoom is by selecting the GraphicsLayer I want by name and then iterating through the graphics contained in the layer and manually build the extent I should zoom to. Once I have the extent, I call ZoomTo(extent) on the map control. When this happens, it zooms to the correct location but sometimes some of the graphics on the map shift or offset themselves from where they should be. It can happen on the GraphicsLayer I'm zooming to or on a different GraphicsLayer that I have added to the map.

After the offset occurs, if I pan the map, the incorrect graphics location persists, but if I zoom in or out, the graphics redraw in their correct location.

Why would zooming to an extent cause some graphics to move in the first place? Do I need to somehow redraw all my graphics layers after the zoom completes - that seems foolish? I should also mention that I call expand on the extent I build to buffer it a bit in the browser window.

0 Kudos
1 Reply
Esri Frequent Contributor

Could you share a screenshot showing the issue? This might help to figure out the issue.

0 Kudos