Part I: The Virtual Earth Silverlight Map Interface
Today we will explore Silverlight and Microsoft Virtual Earth.
Silverlight was originally introduced as a video streaming plug in, but has rapidly evolved into a feature-rich interactive web applications development framework. In turn, Microsoft Virtual Earth, now Bing Maps for Enterprise, is a set of controls and APIs that allow organizations to take advantage of the latest mapping technology to create unique customer experiences by delivering locally relevant information.
As simple as it may sound, this project allows a user, say for example an account executive traveling to see a customer, to obtain not only geographical location information about the customer, but also view important account information on the map interface.
For this project you will need the following laundry list of development tools and technology components:
- Microsoft Visual Studio 2008
- Microsoft .NET Framework 3.5
- Microsoft Silverlight 3 Tools for Visual Studio 2008 SP1
- Microsoft Expression Blend 3 + SketchFlow Trial
- Microsoft Virtual Earth Silverlight Map Control CTP
For having no prior Silverlight or Virtual Earth development experience, this first part of the project went extremely smooth. Of first order, was the creation of the Silverlight Application project in Visual Studio.
After entering the project name, and clicking Ok, I was presented with the option of hosting my Silverlight application in a new Web site and to define the project type of my new Web application. These seemed like logical choices, so I sticked to the defaults. Another option (topic of a future article) is the ability to enable .NET RIA services for my Silverlight application.
Following Microsoft's definition:
Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.
However, for this project, I was going to keep it simple and work with LINQ to SQL to provide data access to my Silverlight application.
After clicking on the OK button, the solution was setup. In reviewing the Solution Explorer, I had a Silverlight client application and a web application as part of the overall solution.
Silverlight client applications also make use of a XAML (pronounced "zamel") page to define and build user interface elements. XAML is an XML-based language that may be used to define graphical assets, user interfaces, behaviors, animations, and more. It was introduced by Microsoft as the markup language used in Windows Presentation Foundation, a desktop-oriented technology that is part of the .NET Framework 3.0. It was designed to help bridge the work between designers and developers in creating applications. In the case of the application, a MainPage.XAML was added.
Of second order, I needed to add a reference to my Microsoft Virtual Earth Map Control. Since this is part of the UI, it was clear enough that a References was needed on the Silverlight client application.
With a reference to the assembly, I could now add two lines of code -- literally -- to the XAML page to incorporate a map interface to my application: one to reference the map control assembly, and the other to give the map some startup parameters.
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<m:Map Name="custMap" Center="41.900632,-87.629631"></m:Map>
I then compiled the code and ran it in debug mode and to my surprise, I had a fully working map solution! Talking about productivity! Wow!
But, while I could make use of the map, this was only the beginning of the work ahead. For now, enjoy this first part. Try it out and let me know what you think.
I leave you with this MIX09 video presentation of Chris Pendleton, Virtual Earth Technical Evangelist at Microsoft, who explains the Virtual Earth Map Control in more detail.
Until next post!
Mariano Gomez, MVP
Maximum Global Business, LLC