Bing Maps Task

You’ve seen in previous Windows Phone Mini-tutorials STATUE of Libertythat all tasks have the same basic structure:

  • Instantiate the task
  • Add any specifying data
  • Show the task

The Bing Maps Task is no different. In fact, it is so simple to use I hesitate to dedicate a mini-tutorial to it.  This will be brief.

To find a specific location using Bing Maps, all you need do is create a new Windows Phone application.  Set the Page and Application title and create a new row into which you’ll place a button (all of this is optional, but it makes the program easier to work with). 

Name the new button FindSiteButton and give it an event handler on its click event, as shown here:

        Text="Bing Maps"
        Style="{StaticResource PhoneTextNormalStyle}" />
        Style="{StaticResource PhoneTextTitle1Style}" />

<!--ContentPanel - place additional content here-->
            Height="96*" />
            Height="511*" />
        Click="FindSiteButton_Click" />

Since you put the event handler into the Xaml, you’ll find a stub for that method in the code behind.  Switching to MainPage.xaml.cs, let’s fill in that event handler.

We do so by adding an instance of BingMapsTask (which you’ll need to add the using statement,

using Microsoft.Phone.Tasks;


Set the SearchTerm property of this task to a famous location and then, as with all tasks, call show:

private void FindSiteButton_Click( 
    object sender, RoutedEventArgs e )
    BingMapsTask bmt = new BingMapsTask();
    bmt.SearchTerm = "Statue of Liberty";


Now run the emulator, click the button and you will see that Bing Maps instantly displays a map with the Statue of Liberty pin-pointed.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in Essentials, Mango, Mini-Tutorial, Patterns & Skills, WindowsPhone and tagged . Bookmark the permalink.

4 Responses to Bing Maps Task

  1. Pretty nice post. I simply stumbled upon your weblog and wished to say that I’ve really enjoyed browsing your blog posts. In any case I will be subscribing for your rss feed and I hope you write once more very soon!

  2. Dann Carter says:

    Microsoft (MSFT) may be a bit behind Google (GOOG) and Apple (AAPL) when it comes to creating a voice-enabled personal assistant for its mobile devices, but it seems the company does have plans to add better speech recognition capabilities to its Bing mobile app in the near future. MSFTKitchen has posted a video demonstration of a new prototype for voice recognition software on Windows Phone devices that’s intended to show how Microsoft has worked to reduce latency and word recognition errors while improving phones’ ability to accurately hear you in crowded, noisy areas.”

    My favorite web site

  3. Lucky says:

    Hi , Thanks for tutorial , is was great . i want to ask , How can i send my lat. and log. to a server and a service that store it and other client can receive it , ?

  4. Jason says:

    Great new feature. This definitely makes working with the mapping api much easier for simple tasks.

Comments are closed.