1
我把这样的Silverlight的必应地图控制图像:如何检索Silverlight bing地图控件上的UIElement的位置?
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(为什么?)。
我该怎么做?