I was inspired by WPF/E and "Layering" Content and Using Opacity with a WPFE / Virtual Earth Mashup to try something similar but different. I wanted to be able to show WPFE content (vector graphics, text, and video) on a map when I hover over a pushpin. So I hacked away and this is what I came up with:
You can download the sample code from here. I still need to investigate how to post working samples to www.publicsectordeveloper.com, so no live demo. I'll post a better code walk through or maybe even a screencast when I have some time. For now, you can download the code and tinker with it yourself.
Here are some things I would like to try to add to the sample next:
- See if I can get it working with the 3D mode of the Virtual Earth Map Control (I had this mostly working, but had to pull the code due to time constraints)
- Add Road/Aerial/Hybrid & 2D/3D WPFE "buttons" next to the Zoom buttons
- Package the sample up as a Windows Vista Sidebar gadget
One of the things I have been asked quite often from customers doing full blown WPF programming is "I'm building a WPF app which uses the WebBrowser control to integrate Virtual Earth. How do I display WPF vector graphics on top of the map?" See my this post for an example of how to do use the Virtual Earth Map Control with WinForms. "The short answer is that you can't due to the fact that the WebBrowser control is a WinForms control which wraps IE. When you use the WinForms integration feature that ships with WPF to host a WinForms control, the WinForms control has a higher z-order than any of the WPF content. Therefore, you can't overlay WPF content on the map. However, using the approach I use in the sample above, you can use WPFE in the hosted html file. Yes, you are running both the WPF & WPFE at the same time. However, you get the benefit of using XAML for both your WPF app and the map overlays. That means you can use the Expression tools for both :). In addition to the TODO above, I plan on putting together a sample that uses the approach I just described.
Make sure you install the WPFE CTP before you try the sample:).