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. Create a copy of our
HelloMaps-Pushpin
project and rename itHelloMaps-Search
.2. Import the
Microsoft.Phone.Tasks
namespace.3. Declare an instance of
BingMapsTask
in your main class as:BingMapsTask myBingMapsTask;
4. In the
MainPage()
constructor, we instantiatemyBingMapsTask
, center it to a position near Redmond, and finally define the search term asPizza
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...