我在WinRT中使用bing映射。我想在触发pushpin_click事件时创建翻译,以便它翻译我地图中心的当前点击的图钉:

private void Pushpin_Click(object sender, TappedRoutedEventArgs e)
{
     var TappedPin = (Pushpin)sender;
     Location currentPinLocation = GetPushpinLocation(TappedPin);
     Map.Center = currentPinLocation;  //How can I make a translation animation?
}


有没有办法在C#中以编程方式实现这一点?

最佳答案

你很亲密您只需要使用MapLayer类获取图钉的位置,并像这样设置地图视图:

private void Pushpin_Click(object sender, TappedRoutedEventArgs e)
{
     var TappedPin = sender as Pushpin;
     Location currentPinLocation = MapLayer.GetPosition(TappedPin);
     Map.SetView(currentPinLocation);
}

10-08 08:12