将文本标签添加到WPF Bing Maps

时间:2012-09-03 18:20:16

标签: wpf-controls bing-maps

是否可以在WPF bing maps中将文本添加到指定位置(纬度/经度)?

1 个答案:

答案 0 :(得分:3)

是的,c#代码隐藏我会假设?

// I just created a Location object from the mouseclick but you can replace labelLocation with anything
Microsoft.Maps.MapControl.WPF.Location labelLocation = myMap.ViewportPointToLocation(mousePosition);

// Create a label
Label customLabel = new Label();
customLabel.Content = "Text here";
// With map layers we can add WPF children to lat long (WPF Location obj) on the map.
MapLayer labelLayer = new MapLayer();
labelLayer.AddChild(customLabel, labelLocation );
myMap.Children.Add(labelLayer);