BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Windows Presentation Foundation
.NET 3.0+

Windows Presentation Foundation

This is the first in a series of articles describing the use of Windows Presentation Foundation (WPF), a powerful technology for creating Microsoft Windows-based, smart client software. The tutorial begins with an overview of the benefits of WPF.

WPF Drawbacks

WPF is a very powerful technology but has some drawbacks. For experienced Windows Forms developers, the difference between the two techniques is large. The flexibility of WPF leads to increased complexity in some scenarios. This means that WPF has a steeper learning curve than Windows Forms and that migrating to WPF requires much learning. The fact that WPF can be used in a similar manner to Windows Forms can be seen as a drawback. Although it allows for faster migration, it sometimes means that new WPF developers are unaware of the power of the new paradigm.

Another problem with WPF for existing user interface developers is that some of the less often used Windows Forms controls are missing. You can download some open-source or free versions of these, or purchase a control suite if preferred. Some controls are not included because you can modify the templates of other WPF controls to create them yourself. However, this can seem like a lot of work when you want to rapidly develop and deploy a simple product.

WPF is extremely flexible. In some cases it is too flexible as it allows you to go overboard with animations, media, 3D objects and the like. If you, like me, are not a good designer, it is easy to create a user interface that become frustrating, unusable or ugly. In these cases it can be better to stick with simpler controls or employ a designer to create your interfaces.

Tutorial Prerequisites

All of the tools required to create WPF applications are provided free-of-charge with versions of the .NET framework that support it. As with other types of application, you can create both the user interface and the background code using a text editor, such as Notepad, and compile it with command-line tools. However, the development experience is richer and more efficient when using an integrated development environment (IDE).

WPF was introduced in the .NET framework version 3.0 but was greatly improved in .NET 4.0. For this reason, the tutorial's examples are based upon version 4.0 technologies. An ideal development environment is, therefore, Visual Studio 2010 or later. However, as this is an expensive option for hobbyists and small businesses, you can also use the free Express editions. As the time of writing, you might select Visual C# 2010 Express or Visual Studio Express 2012 for Windows Desktop.

NB: Although the tutorial targets .NET 4.0, many of the examples and concepts apply to earlier versions too.

21 January 2013