Secret Communications X014Y: Creating Bing Map Apps, working with Lat, Long

Does it seem like there is some sort of secret about Microsoft technology?  Mainly about things that I would think should be obviously important and easy to use.  For instance, I just want to put pins on a  Bing Map showing certain locations.  Wow, that was not easy to find from the online material, in fact, I ran across the process in material that is downloaded via the Bing Map App SDK.  Not the Bing Maps Silverlight Control, nor the online material for Bing Maps. 

To get started, take a look at the MSDN Magazine article (links verified Nov. 6, 2010):

To get the Bing Map App SDK, download it from here:

To find out how to get Lat/Long from clicking on a Push-Pin, the article in the Bing Map App SDK Documentation that you find with the application:


The Bing Map SDK is also useful as it does a great job of introducing a new user to the process of creating a DLL and a great way to test a DLL using the Map App Test Tool.

The article in the Bing Map App SDK Documentation, is titled: “Managing Pushpins on the Map”, however to utilize this article you do need to work through the articles: “Creating a Basic Map App” and “Displaying Entities on the Map”.  Make sure to do the “Creating a Basic Map App” even though it is a “Hello World” as it forces you to utilize the Map App Test Tool. 

In this image I show the process for using your Bing Map App in the Bing Map Test Tool.  The image is a little blurry because of the transfer between MS Word where I put the images together and then did a screen shot.


Now that we went through all of that, the code that I utilized to create the cool Pop-up Title with Lat Long showing after a SINGLE click on the PushPin, hover just gets the title.

private void OnShowPopup(PopupStateChangeContext context)

           context.Title = "Pop-up Title " + context.Content;
           if (context.State == PopupState.Normal)
               string holdLocation1;
               decimal roundLat, roundLong;

               // Display the latlong value of the entity in the body of the pop-up.
               PointPrimitive entityPrimitive = ((PointPrimitive)context.Entity.Primitive);
               roundLat = Math.Round((decimal)entityPrimitive.Location.Latitude, 2);
               roundLong = Math.Round((decimal)entityPrimitive.Location.Longitude, 2));

               holdLocation1 = "Lat: " + Convert.ToString(roundLat) +
                               (char)10 + "Long: " + Convert.ToString(roundLong);

               context.Content = holdLocation1;




End of Secret Communications x014Y


Comments (0)

Skip to main content