Sunday, September 13, 2009

Testing out the SilverLight Map Control

What am I doing right now? Taking the Bing SilverLight Map Control for a quick spin.

The first thing you need to do (after installing the Silverlight SDK) is to download the Silverlight Map Control SDK. It is currently in CTP and can be downloaded from the following site:

https://connect.microsoft.com/silverlightmapcontrolctp

At this time, you need to “self-apply” for access to the CTP (which means you need to log in with a live account and click on the apply link).

Hello World Sample for SilverLight

This was easier than I could imagine.

I created a SilverLight application using the new project wizard:
image

on the next page I had to make sure that I selected that the app would be hosted in a web-site and I set it up as a web-application project.

image

Next, I added a reference to the SilverLight map control to the SilverLight project. (which I found in the following location - C:\Program Files\Microsoft Virtual Earth Silverlight Map Control\CTP\Libraries)

image

Now, I all I had to do was add the control to my SilverLight page. VS had already added a page called “MainPage.xaml”. I had to first add the following line to the navigation node of the document (to reference the namespace of the map-control in the document):

xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl"

image

Final step, add the control to the page.

<m:Map/>

Run the application and you should see the following:

image

That was EASY!

No comments: