0

I'm using Bing Maps in my Windows Store app, I display some pushpins with some locations on it.

What I want to do is when the user taps on a pushpin, a popup appears with some info related to the location of that push pin. something similar to the popup when the user taps on my location in Microsoft maps application

How can this be done ?

MAXE
  • 4,978
  • 2
  • 45
  • 61
Mina Wissa
  • 10,923
  • 13
  • 90
  • 158

1 Answers1

1

Very easy, you can use the Tapped event of your Pushpin to trigger a popup then use a MapLayer.SetPosition to position your popup see http://msdn.microsoft.com/en-us/library/hh846488.aspx

Like this

currentLocationPushpin.Tapped += Current_location_pushpin_tapped;

then

void Current_location_pushpin_tapped(object sender, TappedRoutedEventArgs e)
{
  MapLayer.SetPosition(placesAroundYou,location);
  MapLayer.SetPositionAnchor(placesAroundYou, new Point(-200, 40));
  BingMap.Children.Add(_mapLayer);
}

Try using a Popup control or fake one like this

You can either use a Popup control (see MSDN documentation here) or toggle visibility of a Border element to fake a Popup using Visibility="Collapsed", try this

<Border Background="#FFC3C2BF" Opacity="50" Margin="38,0,0,376" BorderThickness="1" BorderBrush="Black" CornerRadius="8" HorizontalAlignment="Left" MinWidth="50" Width="126" Height="auto">
    <TextBlock x:Name="PushpinText" HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="Black" Padding="10,10,10,10" />
</Border>
MAXE
  • 4,978
  • 2
  • 45
  • 61
Zubair Ahmed
  • 725
  • 8
  • 15