Handling pushpin events
Handling pushpin events is fairly simple. For example, to handle a simple mouse left-click event we use the MouseButtonEventHandler
event handler as:
myPin.MouseLeftButtonUp += new MouseButtonEventHandler(myPin_MouseLeftButtonUp);
Here myPin_MouseLeftButtonUp
is our function that will execute when the event triggers. We declare this as a simple function that shows a message box alert.
void myPin_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Pushpin localPushPin = new Pushpin(); localPushPin = (Pushpin) sender; MessageBox.Show("You are Here : " + localPushPin.Location.Latitude + "," + localPushPin.Location.Longitude); }
The following screenshot shows how it will look in the emulator: