Select to view content in your preferred language

Reset Map Extent

2476
2
07-11-2012 11:44 AM
EricElder
Occasional Contributor
I would like to completely reset the extent of a map.  I have tried:

MyMap.Extent = new Envelope();

This does not work.  It keeps the original extents even after I have deleted all the layers in the map.  Any recommendations?

Basically I'm refreshing the map with all new added layers and need a new extent.
0 Kudos
2 Replies
EricElder
Occasional Contributor
I think I solved it...

MyMap.Layers.Clear();
MyMap.Extent = new Envelope();


Then add new layers.
0 Kudos
PreetiMaske
Esri Regular Contributor
After all layers are removed and new layers are added you would need to reset the map's extent to extent of all layers. Try this

MyMap.Extent=MyMap.Layers.GetFullExtent();
0 Kudos