Search code examples
c#animationwindows-runtimebing-mapspushpin

Bing maps animation translation


I'm using bing maps with WinRT. I want to create a translation when pushpin_click event is fired, so that it translates the current tapped pushpin in the center of my map:

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?
}

Is there a way to realize that programmatically in c#?


Solution

  • You are very close. You just need to get the position of the pushpin using the MapLayer class and set the view of the map like this:

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