John O’Brien, a Windows Live Developer MVP, has been cranking out samples of how to use the Virtual Earth ASP.NET Control. He’s also blogging over at www.liveside.net now. His latest post is titled Server Side Clustering and comes complete with videos! John has also created a site where you can see his samples live and download all the samples at http://veasp.soulsolutions.com.au/. He’s organized the samples in a similar fashion to the Virtual Earth Interactive SDK. If you are leaning towards using the Virtual Earth ASP.NET Control, then you’d be silly not to check this stuff out!
In this screencast, I build off of the concepts shown in my previous screencast and show you how to render a polygon on a Virtual Earth map using REST, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.
To learn more about the GeoRSS utility library, visit:
A big thanks to Eugenio Pace for letting me use it as part of my sample!
In this screencast, I show you how to draw a polygon on a Virtual Earth map and save it using ASP.NET AJAX, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.
First, let me apologize since I promised to make this recording available almost two months ago. I was trying to get the recording uploaded to the same Live Meeting servers as my other webcasts. Needless to say, I had some challenges. I decided to upload it to Silverlight Streaming. I had to split the presentation into two files since this is a 90 minute presentation and Silverlight Streaming has file size limits.
[Double click the video to view full screen]
[Double click the video to view full screen]
Here are some download links for the webcast:
The sample demonstrating hosting Virtual Earth in a Windows Presentation Foundation (WPF) is old. I have an updated sample. Details about the updated sample are available at http://blogs.msdn.com/devkeydet/archive/2008/06/24/wpf-and-virtual-earth-revisited.aspx. You can also watch a screencast about the updated sample at https://channel9.msdn.com/posts/keydet/Using-Virtual-Earth-in-a-WPF-Application/.
I talk to people about programming with Virtual Earth quite often. Beyond the developer APIs, my Virtual Earth knowledge somewhat limited. I get asked all sorts of interesting questions about the technology behind Virtual Earth. My answer is usually "Good question, I don’t know." If you are one of those people that love know about all the nuts and bolts, then you are going to love Mark Brown’s new "Behind the Maps" series. The first in the series covers the UltraCam. Check it out here.
As promised, here is the screencast for my previous post:
I created the beginnings of a WPF Virtual Earth control. That’s right, one you can just reference, add to your XAML, and start programming against without having to know the dirty underbelly of how it is implemented.
I decided to use the new WPF WebBrowser control that is in the .NET Framework 3.5 SP1. The WPF WebBrowser control is similar to the WinForms WebBrowser. The WPF WebBrowser control has the same z-order as it’s WinForms counterpart, but it eliminates the need for WinForms interop.
The WPF map control allows you to create WPF UserControls and have them appear on top of the map:
In the picture above, the InfoBox, which is the term Virtual Earth uses for the UI that pops up when you hover over a pushpin, is a UserControl that uses WPF databinding to show Title and Description. I am clearly not taking advantage of the power of WPF in this example, but you get the point:). You achieve this through the following code:
You set the InfoBox property of the map to an instance of your UserControl. The map control does all the heavy lifting of positioning/showing/hiding your UserControl. The map control also allows you to add as many UserControls as you’d like through map.AddControl. However, you are responsible for positioning the controls yourself. In the picture below, I have replaced the default Virtual Earth Dashboard control with a UserControl containing WPF buttons:
If the WPF WebBrowser control still has the z-order issue, then how am I rendering WPF content on top of the map? I am using what I have been calling "layered window trickery" for lack of a better term. The map control loads a transparent window with a higher z-order than the window the control is in. The map control places the transparent window itself "covering" the area of the map control. Since the top window is transparent, interaction with the map below behaves as if there isn’t a window over the map control. When a call is made to map.AddControl() or to set the map.InfoBox property, I actually add the UserControl to the top window. As you can imagine there is a bit of repositioning logic for the top window & WPF UI over top of the map. I plan on recording a Channel 9 Screencast walking through the code. If you can’t wait, then you can just download the sample here and dig through it yourself. The control uses new features in the .NET Framework 3.5 SP1. Make sure you install Visual Studio 2008 SP1 Beta before trying to open it. Details here.
digg_url = ‘http://blogs.msdn.com/devkeydet/archive/2008/06/24/wpf-and-virtual-earth-revisited.aspx’;
digg_skin = ‘compact’;http://digg.com/tools/diggthis.js
So I have been playing around with other approaches to the workaround described here. The first thing I tried was:
Interestingly enough, this approach works well in another scenario:
In this scenario you won’t get Intellisense for x above the if statement because Visual Studio does not perform return type analysis. However, using the same trick, you can see that you get Intellisense after the if statement. This makes life better in a number of scenarios. However, it does litter your code a bit. Use it at your discretion:). One could write a little utility that scans .js files and removes these entries based on a regular expression. Maybe we’ll look at writing something such a utility for our next release.