Windows Presentation Foundation Introduction Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Windows Presentation Foundation (WPF) is part of the .NET Framework 3.0 and higher. WPF is a newer generation UI framework to create Windows client applications with a rich user interface experience. WPF extends the core with a comprehensive set of application-development features that include Extensible Application Markup Language (XAML), controls, data binding, layout, 2-D and 3-D graphics, animation, styles, templates, documents, media, text, and typography. (MSDN, 2010). We can use WPF to develop graphical user interface for both windows-based application and web-based application.

XAML is a new descriptive programming language developed by Microsoft to write user interfaces for next generation managed application. (CHAND, Mahesh, 2007) WPF provides XAML language support, so the UI creation part is done by XAML. You can create visible UI elements on the declarative XAML markup, and then separate the UI definition from the run-time logic by using code-behind files, joined to the markup through partial class definitions. (MSDN, 2010) XAML can be known it as ASP.NET or Windows Forms, because in the case when you want to write a Web application in ASP.NET or want to write a Windows application in Windows Forms, now you can use XAML to create user interface instead of use Windows Form and ASP.NET. In fact, XAML does not replace the ASP.NET and the Windows Form, both also be supported on the .NET framework 3.0, so you can choose not to use XAML.

WPF separates the Behavior and appearance, the appearance part is implemented in Extensible Application Markup Language and the behavior part is implemented in the managed programming language such as VB.NET, C#. This separation bring some benefits to the system development, which are the appearance and behavior are loosely coupled, the designer and the developer can work separately and the graphical design tools can work on simple XML documents instead of parsing code. (MOSER, Christian, 2010).

Top 10 Features of WPF

Declarative Programming

Declarative programming is a way of specifying what a program should do, rather than specifying how to do it. (KHAMBEKAR, Archana, 2010). WPF application provides the way for developers to define the thick client UI in a declarative way, which the traditional .NET windows form does not supported. With this declarative programming it makes some works like as define a template for a user control and other similar work done in much easier way.

Independent of Screen Resolution

Independent of screen resolution means the WPF user interface does not affect by the screen resolution, no matter how low the screen resolution, the WPF user interface will also look elegant. This is because it uses DirectX components where as the Windows Forms applications make use of the User 32 components of a machine. WPF frameworks have used the Media Integration Layer (MIL) to integrate with the DirectX components. The direct components impose a vector based graphics on the WPF user interface.

Control inside a Control

WPF allows you to define a control that contains another control as content of the original control. In traditional Windows form, a control for example, a button, the only content of a button is text, but WPF allow you to have another control like a textbox inside the button as the Figure 2.1 shown below.


Figure 2.1

Control Templates

Control template is one of WPF features which allow user to change the shape of the control. For example, a original shape of a button is rectangle, the user may allow to change it to circle by defining the control template.

Control Transforms

WPF contains a handful of 2D transform which will enable you to change the size, position, rotation angle and also allows skewing. Control transform can be either applied before the control is laid out on the form or after the control is laid on the form. There are five types of transformation available in WPF, which are rotate transform, skew transform, translate transform, matrix transform, and scale transform.

Availability of Different Layouts

WPF contains few types of layout, which use to separate the controls in the user interface logically and present the control tidy on the window. There are some main layouts in WPF which stack panel, wrap panel, dock panel, dock panel, grid, and canvas. Those layouts are serving different purpose.

2D, 3D Graphics, animations and media

In WPF, user can define a control in to 2D graphics, 3D graphics, and animation, also can include media into the user interface.

Styles & Resources

Any object in WPF could be a resource which can be later used by the element on the Window. For example, a object like color brush, string, style and etc can be a resource. User can access the resource through the attribute. A style is defining the properties for the controls, it is a way that provide a common style for controls and user may not need to do a repeat step in order to create a same design control.

Databinding in WPF

With the databinding in WPF user may not bother about the synchronization of a data between the data source and the user interface element. User just needs to specify the target of the user interface element as a dependency property.

DataGrid availability

DataGrid does not included in WPF, instead of download a third party WPF data grid control, Microsoft has released a WPF toolkit which can integrate to the Visual Studio IDE. The WPF datagrid contain some key feature which are auto generate column, data validation, styling, and so on.

(ARUN, V.N.S, 2010)

Windows Presentation Foundation development tools

There are two main development tools of WPF application from Microsoft, Visual Studio 2010 and Expression Blend 3 + Sketch Flow. Microsoft Visual Studio 2010 is made for developers use and Microsoft Expression Blend 3 + Sketch Flow is made for user interface designer.

Microsoft Visual Studio 2010

Microsoft Visual Studio is a development tools that can develop various type of application, such as windows application, web application, web site, WPF application and so on. Visual studio provide comprehensive guided access to data binding capabilities and convenient tools for finding and applying styles and resources to change the look of your application. (MOSER, Christian, 2010)

Microsoft Expression Blend 3 + Sketch Flow

This Microsoft Expression Blend is one of the development tools for WPF application. Usually this is used by the user interface designers. Expression blend covers all the missing features of the Microsoft Visual Studio designer like template, animations, resources, gradient, 3D graphics and the styling part. (MOSER, Christian, 2010)

Comparison between WPF with other relevant technology

WPF vs. Windows Forms

Generally, WPF is just an improved version of Windows Forms; it is not a replacement of Windows Forms. In term of choosing which platform is suitable is all depend on what the user requires for their application. For example, if the application includes various types of media, 2D or 3D graphics content, animation or any dynamic interface, WPF is suggested to use to develop that application. If the user just need to have a normal interface without any graphical design, Windows Forms is suggested to use.

User Interface

Control Type


Programming Style

System Requirement

Special Features

Development Tools

Other Differences

Strength of WPF

The user interface design and code can develop separately

Normally, the person who is very expert in programming logic may not perform very well in designing part. In opposite, the person who is able to do well in interface design may not expert in programming logic. So, if the design and code is separate, these two tasks can be assigning to different people to handle. The coding part assign to the person that expert in coding and the design part assign to the person that expert in designing. If the case when the code and design cannot do separately, this may cause spend longer time to develop the application.

More properties settings are available

The properties settings are use to design an object, the more properties available the more powerful object design produced. That is the reason why WPF is able to make such rich user interface relatively easily.

Powerful databinding

Compare to the Windows Forms, WPF has more powerful and comprehensive databinding which has been minimized the amount of code you need to write and just takes few clicks in order to bind the data.

The declarative style of programming

WPF is use declarative style of programming, you only need to declare what you want the system do, instead of tell the system how to do by provide the steps to the system. The code of declarative programming style is shorter than the procedural style programming and it is easier to read.

Weakness of WPF

WPF still under the learning curve

WPF still new for the development area, many developers are still learning the WPF. So application develop currently may be unstable. It may also require more time to learn the WPF.

Required more resources

In order to run the application that developed by WPF, the computer used must be contain higher specification than the computer used to run the winforms developed application. This is because WPF have more advance graphical user interface. The suggested specifications of a computer that required in order using the WPF applications are at least 1 GB RAM, graphic card required in the computer, the operating system must be higher than Windows 2000. If the computer does not have the suggested specification stated above except the operating system, it is still able to run the WPF application, but performance of the application will not good, it take times to load the interface. (WPF versus Winform, 2009)

Strength of Windows Forms

Winforms is a mature proven technology

Winforms was an early and easy way to provide graphical user interface components to the .NET Framework, like AWT, and also the equivalent Java API. It is built up when the existing Window API and some controls are merely wrap underlying Windows components. (Wikipedia , 2010). Most of the windows developers are know winforms very well, so that the performance in development compare to WPF and winforms, winforms will be better than WPF. This is all because the WPF is still new, and learning is cannot done overnight.

Weakness of Windows Forms

May not Improve in future

Because of the release of WPF, WPF provides the more powerful feature that winforms don't have, such as the platform-independent between the design user interface and programming part. Nowadays, winform seem to have a little bit effect on superseded by WPF. Since the WPF is quite new now, there are not sure the winforms will improve in the future .NET release. (SMITH, Josh, 2007)


ASP.NET is a server side scripting technology that enables the embedded scripts to execute by an internet server.


Strength of WPF

Richer User Interface

WPF is able to provide the rich user interface is because WPF support XAML.

Coding is understandable by windows programmers

Weakness of WPF

Required .NET and Internet Explorer to access the WPF application

Users are required to install the complete .net framework into their computer when they want to run the WPF browser applications. That means the developers need to add extra direction to let user to download and install the .net framework then the user only can use the

Slow Load Time

WPF has more advance graphical user interface, so it requires more resources to run the application will take longer time to load the application.


Strength of ASP.NET

Cross browser compatibility

ASP.NET has a more standard based approach on develop a web application. The reason is the ASP.NET code will be convert to HTML after the ASP.NET code is executed. HTML is a most standardized approach for a web development which means it can be run on the entire current platform and probably in the future platform also. Compare to WPF, ASP.NET is more compatible and more portable to current platform, it is able to run on most of the browser in the market now. (CAMPBELL, Chad, 2007)

Weakness of ASP.NET

Limited User interface

Compare to WPF, ASP.NET does not have the control template features to allow user to create their own control and save to template for multiple usage purpose. Some of the controls properties settings that WPF have like gradient color, transparency of the control are not able find out in the ASP.NET.

Required cross browser testing

ASP.NET is compatible on most of the web browser, so that mean the developer need to do the testing on different browser, such as Internet Explorer, Google Chrome, Mozilla FireFox, Opera, Safari, and so on. Usually Internet Explorer will be less compatible problem than other because Internet Explorer is comes from Microsoft. So the time on doing testing will be longer. (TRIVEDI, Tejas, 2010)

Programmer required to learn web model

Good internet bandwith is required

Actually, the WPF browser application is a window application that is usually run on client side browser sandbox. So that, the user need to have good internet bandwith to download the application into the client;s side computer and the size of the application is large. (TRIVEDI, Tejas, 2010)

WPF vs. Silverlight

As I know that Silver light is a Microsoft technology, which it is competing with Adobes Flash and it is more on develop browser based internet application. WPF (Windows Presentation Foundation) is also a Microsoft technology, which it is developing enhanced graphics application for desktop platform. In others words, Silver light (Known as WPF/E (E from Everywhere)) is a subset of WPF targeted at web application running in the browser. In these two Microsoft technology, they had their own condition or features, which in developing a application areas, so when developer want to choose Microsoft technology between this two technology, then developer must know many requirements and conditions of the new application, which it is planning to develop. There are several conditions and features compare between Silver light and WPF. (Wikipedia, 2010)

Silver light

Application Type provided in Silver light.

Silver light is a web based technology, which it is only can run in browser or can be browser only. When browsing Silver light application, it needs to add or install Adobe Flash to support Silver light on displaying it out. The root tag of Silver light application is User Control.

Functionality and Deployment provided in Silver light.

Silver light can deployed or developed into many more platform and browsers, such as platform of Windows, Mac, and Linux (via Moonlight); browsers such as Internet Explorer, Firefox, Safari, and Chrome (all contains of Adobe Flash installed). Silver light functionality is a subset of WPF's feature set, but it is not supported in 3D graphics, Printing, XPS Documents, Speech, and Freezable objects. In commands of Silver light Application, it is supported commands in buttons, hyperlinks, context menu items and others controls are available in Silver light, but there are not input binding and routed commands in silver light application. It also can supports browser interop, more media streaming options including timeline markers, and Deep Zoom.

Runtime Distribution and Security of Silver light Application.

For the users must have Silver light with .Net Framework 3.5 or the latest version installed, and Adobe flash is needed. Silver light is running on a Web Server, and needed one machine or a few of machine for load balancing and web farms purpose for all the users. Silver light application will be less secure than WPF application, because data is transferred on the Web using HTTP.


Application Type provided in WPF.

WPF is a standalone windows client application and can be a replacement of Windows Forms. In others words also, it can be say as a window based application, because it can run as windows application, and it also can be running as web "browsers application" (called XBAP, for "XAML Browser Application"), but only can run in Internet Explorer with .Net 3.0 and Firefox with .Net 3.5. The root tag of WPF is Window.

Functionality and Deployment provided in WPF.

WPF can be deployed to the desktop and also can run in internet explorer, but it only can run in Windows machines only, such as Window XP, Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008, and windows version onward. Functions inside or available for WPF is many much, or can be say is richest functionality. Functions available, such as supported 3D graphics, validation, XPS documents, Speech, Freezable objects, and also full access to all the windows API and the full .Net API. Powerful in printing support, which many option of printing method use, like access to Print Dialog and control print queues. Input binding and routed commands also available in WPF. But WPF are not supports browser interop, which it is only available in Silver light.

Runtime Distribution and Security of WPF Application.

WPF is running in or as an executive file (.exe) on the user's machine, so users or clients need to install the executable independently of other clients. It is good user base for one machine one user only. WPF is running in windows form, so it is totally secure, because it is only current user has access to the application data. All users need to have .Net Framework 3.5 or latest version of .Net Framework, but if users machine platform is Windows Vista or latest version of Windows like Windows 7 or onwards, then users do not need to install anything in their machines.

WPF vs. WCF (Windows Communication Foundation)

Why Choose WPF in develop my system

Use window form often during study times, this an opportunity to learn new things.

ASP.NET is usually used to design web-based application, and my project is window-based application

WPF got a simple and easy development tools which is Microsoft Expression Blend.

How the WPF styling my system