Question

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

Was it helpful?

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);  
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top