Adding graphics to a Map! part 2

I promised I was going to explain that obscure “Marker_Click” that I mentioned (and included) in my last post, and here I am going to do that!

Here’s the full brunt of the code we are going to analyse:

private void Marker_Click(object sender, EventArgs e){
     Polygon p = (Polygon)sender;
     GeoCoordinate geoCoordinate = (GeoCoordinate)p.Tag;
     MyReverseGeocodeQuery = new ReverseGeocodeQuery();
     MyReverseGeocodeQuery.GeoCoordinate = new GeoCoordinate(geoCoordinate.Latitude, geoCoordinate.Longitude);
     MyReverseGeocodeQuery.QueryCompleted += ReverseGeocodeQuery_QueryCompleted;

This code is meant to show something when the Marker we created following the precedent post guide is clicked.

How are we going to accomplish this step? Easy, we’ll just add a function, “ReverseGeocodeQuery_QueryCompleted”, to the stack of functions that is started each time the query MyReverseGeocodeQuery is completed.

What will  the MyReverseGeocodeQuery do? It will work as any other ReverseGeocodeQuery as it will give you the coordinates location of the location name it will be provided of.

Summing it up, the “ReverseGeocodeQuery_QueryCompleted” will basically show a MessageBox containing the info you’d like to see when tapping on the marker.

If everything was done correctly, what you will see on your phone screen should be something like this:


Happy mapping and happy coding! 🙂


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.