1

I put image on the silverlight bing map control like this :

MapLayer mapLayer = new MapLayer();
this.myMap.Children.Add(mapLayer);

Image image = new Image();
BitmapImage btm = new System.Windows.Media.Imaging.BitmapImage(new Uri("/myAssembly;component/Images/myImage.png", UriKind.Relative));
image.Source = btm;
LocationRect rect = new LocationRect(new Location(10, 12), new Location(55, 55));

mapLayer.AddChild(image, rect);

This is working fine. But I can't find how to retrieve the location somewhere else in my code. I try :

var loc = MapLayer.GetPosition(image) --> Always returning null !!!

The maplayer object doesn't have any methods to get children locations and I can't calculate the position with mapLayer.ParentMap.TryViewportPointToLocation because the image Width and Height properties are always 0 (why that ??).

How can I do this?

Kara
  • 6,115
  • 16
  • 50
  • 57
Ben
  • 247
  • 1
  • 3
  • 15

1 Answers1

0

you can retrieve the location if you save it somewhere before adding. Keep these in some variables somewhere.

new Location(10, 12), new Location(55, 55)
Uğur Gümüşhan
  • 2,455
  • 4
  • 34
  • 62