Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Windows Phone 7.5: Building Location-aware Applications

You're reading from  Windows Phone 7.5: Building Location-aware Applications

Product type Book
Published in Jul 2012
Publisher Packt
ISBN-13 9781849687249
Pages 148 pages
Edition 1st Edition
Languages

Table of Contents (11) Chapters

Windows Phone 7.5: Building Location-aware Applications
Credits
About the Author
About the Reviewers
1. www.PacktPub.com
2. Preface
1. The Location-based World 2. Using Location in Windows Phone 7.5 3. Using Maps in your Windows Phone App 4. Events App - PacktEvents 5. Location-aware News App — PacktNews

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:

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}