One of the great new features of Visual Studio 2008 is the baked in support for Windows Presentation Foundation (WPF) application development. WPF has been around for some time and shipped as part of Microsoft .Net 3.0. Unfortunately, in order to develop solutions based on WPF you were required to download beta components to snap into Visual Studio 2005.

With Visual Studio 2008, creating high fidelity applications for Windows using WPF is simple.

Create a new project and you will see that WPF Applications are now a first class citizen:



After creating this new project we get a standard project made for us. This project contains a single window that has nothing on it – effectively a blank canvas for creating some cool new application.



There are several things of note when designing your application interfaces. The first is that we can view the application code and the rich WYSIWYG view at the same time with a split view.

This is something new to Visual Studio 2008 and allows developers to see, in real time, their changes to both code and interface. This is hugely beneficial, especially when you are new to WPF development, to see exactly what code is changed when you make a change using the designer.

Speaking of changes, notice the little green block on the side of the text area? That highlights that I have made a change – yellow would mean I had made an unsaved changed while green denotes that this change has now been saved. This has been a nice addition since Visual Studio 2005 but it is certainly worth understanding if you’re new to Visual Studio in general.

Lastly, WPF is a modern presentation framework and therefore everything is vector based. This means that all elements are finitely scalable without losing fidelity. The zoom bar on the left allows us to zoom in and out of our interface fluidly to see how it might look when scaled in, or how it may look on higher definition screens in the future.


The toolbox palette includes many of the controls that developers would expect to see when developing modern applications. Developers can drag and drop these controls onto the form design surface and manipulate their layout.

Once a control is placed on the design surface developers can modify the properties with the properties explorer (shown below) or by editing the UI code (called XAML and pronounced zammel, xaml is an XML based language for declaratively building WPF user interfaces. Visual Studio 2008 understands this syntax and will colour highlight it appropriately).



Here we have set the buttons content property to display the text “Hello World”. WPF is incredibly flexible and most controls can host other controls. This means that we developers can create impressive composite controls with ease. Further to this, the actual style of a control can be separated from the actual instance of the control (similar to how css can be used to style html elements).

WPF allows us to start getting really fancy with rotations and transforms as well. Sure, it is not recommend that you tilt every button in your next application however with the flexibility there you can be sure that you won’t run into some of the challenges that were common in older Windows Forms development.



We should add some code to this application for completeness sakes. For this simple example we want to make it so that the application will close when the button is clicked. To do this, simply double click the button in the designer and the appropriate click event will be stubbed out for us automatically and wired up.
This saves us time and is the same behavior that is found in Windows Forms.



Now when we press F5 and run this small application up we should see a familiar site – an application window – with an unfamiliar one, a fully vector bases, rotated button.

If you are looking at building high end applications to really leverage WPF then I would recommend checking out the Family.Show application built by Vertigo Software here.

Having WPF as a first class citizen of Visual Studio 2008 is fantastic for developers – first class tooling support for such an impressive technology is always helpful.

Keep in mind that WPF offers considerably more than we have covered in this article and this only highlights some of the integration points for WPF development in Visual Studio 2008. There is a wealth of information about WPF available online and I would strongly suggest developers start looking at this technology as a replacement for Windows Forms development.

Also, these screenshots are my own and the black background code view is not standard with Visual Studio 2008. If, like me, you like it, then you can easily modify the colours used by Visual Studio under Tools -> Options -> Fonts & Colors.

Download Visual Studio 2008 90 day trial
For detailed information and to request a free 90-day trial DVD of Visual Studio 2008 Team Suite to be sent out to you, go to the Microsoft Visual Studio webpage.

About the Author

John-Daniel Trask is a co-founder of Mindscape, a product development company based in Wellington New Zealand. He also maintains a popular blog about software development and business.</img>
</img> </img> </img> </img> </img> </img> </img> </img> </img> </img>