【发布时间】:2015-04-16 14:18:27
【问题描述】:
我目前正在使用 Windows 8.1 应用程序中的 Bing 地图,其中需要拖动图钉并在放下图钉时获取位置。我使用的图钉是第三方控件,我在 Google 上进行了一些搜索后发现。但由于我是 Windows 8.1 开发的新手,我不太了解触摸事件以及如何处理拖动事件。任何人都可以用一些示例代码建议我如何做到这一点。
请帮忙。
此外,在显示位置时,我面临放大和缩小问题,图钉会从其位置移开。这是我显示位置的代码
Map map = frameworkElement as Map;
map.Credentials = "My Bing Maps Key";
//map. = MapCartographicMode.Road;
map.ZoomLevel = 15;
Bing.Maps.Location location = new Bing.Maps.Location()
{
Latitude = Convert.ToDouble(value.GetType().GetRuntimeProperty("LATITUDE").GetValue(value, null)),
Longitude = Convert.ToDouble(value.GetType().GetRuntimeProperty("LONGITUDE").GetValue(value, null))
};
MapLayer layer = new MapLayer();
map.Children.Add(layer);
MapControl.Pushpin pushpinPin = new MapControl.Pushpin();
pushPin.Background = new SolidColorBrush(Colors.Red);
pushPin.Margin = new Thickness(-12, -12, 0, 0);
TextBlock Nametxtblk = new TextBlock()
{
Text = value.COUNCIL_NAME,
Width = 250,
TextWrapping = TextWrapping.Wrap,
};
pushPin.Content = Nametxtblk;
MapLayer.SetPosition(pushPin, location);
//MapLayer.SetPositionAnchor(pushPin, new Point(Width/2, Height/2));
layer.Children.Add(pushPin);
map.SetView(location);
break;
这里,MapControl.Pushpin 是一个第三方控件,我用它来显示位置。
更新
我在下面添加我的图钉图片。请建议。
【问题讨论】:
标签: c# windows-8.1 bing-maps