I've seen many questions regarding Atlas VirtualEarthMap control and assigning different images for different pushpins. The common solution is to use a single image for all pushpins on a map by specifying the map's [code language="C#"]pushpinImageURL[/code] property, but if you want pushpins to be represented by different images, you have to look a bit further. I took a closer look at this while playing with VirtualEarthMap, and the solution seems quite obvious: if you're retrieving your pushpin data from a web service, you probably defined a pushpin class, like:
[code language="C#"]public class Pushpin
{
private int id;
private double latitude;
private double longitude;
// other fields
#region properties
// ...
#endregion
}[/code]
Now, let's say you're marking important building in your area and you have prepared some image files like police.gif, fire.gif, hospital.gif , hotel.gif,... You would want to define another field in that class to represent the your pushpin image file, e.g. [code language="C#"]pushpinImage[/code]. Then, in your virtualEarthMap declaration, replace the [code language="C#"]pushpinImageURL[/code] property with these two:
[code language="C#"]dataImageURLFormatString="images/{0}"
dataImageURLField="PushpinImage"[/code]
The {0} part will be replaced with whatever is in [code language="C#"]pushpinImage[/code] (image filename), and your emergency map is ready to use.
One thing I noticed using VirtualEarthMap - binding to more than 10 pushpins at once significantly slows down the loading process. I'm not sure why, but once they are loaded, there are no more hiccups.
536a1728-2e26-479f-8136-5a45725c8006|2|1.0|27604f05-86ad-47ef-9e05-950bb762570c
Tags :