How to correctly remove SurfaceVEMap instance

Feb 9, 2011 at 5:59 PM


I created an scatterviewitem which contains an surfacevemap instance. This first instance works as expected. When I clear all the items in my scatterview, and I try to add a new scatterviewitem with an new surfacevemap instance I will get an nullreferenceexception.

Is it necessery to "unload" the first surfavevemap instance in a way that it will allow the second instance to be created?



Feb 13, 2011 at 10:22 PM

Due to the way Bing Maps 3D works, you can only have one instance of the map per process (or app domain, perhaps). Depending upon how and when you are removing the first SVI, the map may not have been disposed and the second instance fails because bits of the first one are still somewhere in memory.

I would recommend just hiding the map SVI and reusing it when you need it again. This will also minimize loading and initialization times when displaying the map again.