I am trying to add multiple pushpins to the map, that disappear when you zoom out enough, to make the pushpins so little, that they are not rendered anymore.
I managed to achieve this effect with the following code:
MapPolygon shape = new MapPolygon();
GeoCoordinateCollection boundingLocations = CreateCircle(geoCoordinate, 0.1);
shape.Path = boundingLocations;
shape.FillColor = Color.FromArgb(0x55, 0xFF, 0xFF, 0x00);
shape.StrokeColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF);
shape.StrokeThickness = 4;
mapToDrawOn.MapElements.Add(shape);
But what I really want to do is fill the polygon with a custom image. The image has to be placed in the specific point of the map, and relate its size to the level of zoom. (just as in the above example) This is the code that I tried to use:
MapLayer layer = new MapLayer();
MapOverlay overlay = new MapOverlay();
Polygon polygon = new Polygon();
polygon.Points.Add(new Point(0, 0));
polygon.Points.Add(new Point(0, 75));
polygon.Points.Add(new Point(25, 0));
BitmapImage arrImg =
new BitmapImage(new Uri("/Images/arrow.png", UriKind.RelativeOrAbsolute));
ImageBrush imgBrush = new ImageBrush();
imgBrush.ImageSource = arrImg;
polygon.Fill = imgBrush;
overlay.Content = polygon;
//geoCoordinate is the argument of a method
overlay.GeoCoordinate = geoCoordinate;
layer.Add(overlay);
mapToDrawOn.Layers.Add(layer);
It doesn't work. The image appears in the specific point of the world, but when I zoom out, image keeps its size. I believe that the problem is caused by the lack of some Rectangle restricting the polygon, but I can't find anything to start with. Please help.