我将图像放在 silverlight bing 地图控件上,如下所示:
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);
这工作正常。但我找不到如何在我的代码中的其他地方检索位置。我尝试:
var loc = MapLayer.GetPosition(image) --> Always returning null !!!
maplayer 对象没有任何方法来获取子位置,我无法计算位置,mapLayer.ParentMap.TryViewportPointToLocation
因为图像Width
和Height
属性始终为 0(为什么??)。
我怎样才能做到这一点?