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?