Search code examples
c#windows-phone-8bing-maps

Open native maps in Windows phone 8 application on button click


Is there a way to open Bing maps that are inbuilt to Windows phone on click of a button. If you have used the Foresquare app, it loads bing maps and show the destination latitude and longitude when you click the directions button. I want to do the exact same thing. Please help me with any resource you have. Until now I tried the code in this link https://msdn.microsoft.com/library/windows/apps/jj710324%28v=vs.105%29.aspx

Problem is when I click the button it says do you want to search an app in the appstore. Please help.


Solution

  • You have to use BingMapsDirectionsTask like this (just replace latitude and longitude with yours):

    BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
    GeoCoordinate spaceNeedleLocation = new GeoCoordinate(47.6204,-122.3493);
    LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation);
    bingMapsDirectionsTask.End = spaceNeedleLML;
    bingMapsDirectionsTask.Show();
    

    You can reed more here about Bind Maps directions task.