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

Performing local searches with BingMapsTask


The BingMapsTask is similar to the BingMapsDirectionsTask Launcher, except for the difference that BingMapsTask launches the Bing Maps app from the Windows Phone, and can allow it to be pre-populated with a search keyword or mark locations on the map.

We can modify the previous example to use BingMapsTask and populate a search result for Pizza when the hyperlink button Search for Pizza is clicked or touched:

  1. 1. Create a copy of our HelloMaps-Pushpin project and rename it HelloMaps-Search.

  2. 2. Import the Microsoft.Phone.Tasks namespace.

  3. 3. Declare an instance of BingMapsTask in your main class as:

    BingMapsTask myBingMapsTask;
    
  4. 4. In the MainPage() constructor, we instantiate myBingMapsTask, center it to a position near Redmond, and finally define the search term as Pizza using the following lines of code:

    // Show Bing Maps and search for Pizza
    myBingMapsTask = new BingMapsTask();
    myBingMapsTask.Center = new GeoCoordinate
    (47.6601, -122.13333);
    myBingMapsTask...
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}