MSDN Magazine - December 2007 - (Page 46) Scott Wisniewski Map Create Dynamic Maps With Visual Basic 9.0 And WPF ’ve always had a bit of a fascination with drawing maps. I also think that Visual Studio® 2008 and Visual Basic® 9.0 are amazing. As a result, when I got the opportunity to play around with Visual Studio and then write an article about it, I figured the perfect topic would be a tutorial on how to draw maps using Visual Basic. This would give me the chance to not only demonstrate some cool Visual Basic features, but also to give you a working sample you could use as a basis for adding similar functionality to your own programs. The result of my work is shown in Figure 1, which displays a screenshot of an application that uses a heat map to visualize the population of the United States. The application was built by heavily leveraging the Windows® Presentation Foundation (WPF) data-binding infrastructure, which has granted me the ability to effectively separate my application’s domain-specific logic from the user interface visualization. I’ll start with a brief overview of some preliminary WPF databinding topics in the next section, then I’ll spend the rest of the article walking through how I wrote the application. I’ll first describe the application’s Visual Basic object model, and then I’ll discuss how I was able to use the innovative new XML features in Visual Basic 9.0 and LINQ to implement my data-processing logic. I’ll conclude by showing you how to use WPF to effectively visualize the application’s data. 46 msdnmagazine LINQ WPF Data Binding The WPF data-binding infrastructure is based around the concepts of dependency objects and dependency properties. A dependency object provides support for change notification and the ability to dynamically fetch and retrieve property values. A depen- This article is based on a prerelease version of Visual Studio. All information herein is subject to change. This article uses the following technologies: WPF, Visual Basic 9.0, LINQ This article discusses: WPF dependency properties ✥ Querying XML using LINQ ✥ Drawing the map ✥ Visualizing map data ✥ Code download available at: msdn.microsoft.com/msdnmag/code07.aspx Scott Wisniewski is a Software Design Engineer at Microsoft, where he works on the Visual Basic compiler. For the upcoming Visual Studio “Orcas” release, he worked on several features, including nullable types, error correction, and extension methods. You can e-mail Scott at scottwis@microsoft.com or contact him through the Visual Basic Team blog (blogs.msdn.com/vbteam). http://msdn.microsoft.com/msdnmag/code07.aspx http://blogs.msdn.com/vbteam
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.