Pin Me

Introduction to Windows Presentation Foundation

written by: •edited by: Lamar Stonecypher•updated: 2/7/2012

An introduction to WPF (the Windows Presentation Foundation), programming WPF and programming environments, XAML, and a look at the types of applications that can be created using WPF.

  • slide 1 of 3

    What is WPF?

    Regarded by many as one of the most radical changes to hit Windows since Windows 95, WPF is a completely new graphical system.

    Prior to WPF, windows application were usually based on two display technologies - user32 and GDI/GDI+. Both technologies have been in use for years, and even though recent development tools offer better wrappers for interacting with them, the fundamental limitations of these technologies remain the same. WPF helps overcome the limitations of these aging display technologies and offers an entirely new graphical system which enables you to create visually stunning and effective windows applications.

    WPF stands for Windows Presentation Foundation. WPF is a subsystem in .NET framework 3.0, the graphical or presentation system, which is used to create windows and browser-hosted applications. To see an example of what WPF can do, look at the Yahoo Messenger for Vista. To put it simply, we can say that WPF is a set of APIs which can be used to build graphical user interfaces for Windows application with the .NET Framework.

    Some of the mentionable features of WPF includes support for vector graphics which allow for lossless scaling and a built in set of brushes and pens which make creating graphics easier. WPF features superior 3D capabilities that are a subset of Direct3D and that make it possible to create 3D user interfaces. Easily manageable time-based animation capabilities are provided. These include a storyboard to coordinate scenes, data binding support for LINQ (Language Integrated Query), and support for paginated documents. WPF can also access the Windows Imaging Component to allow developers work with image codecs.

    The WPF core consists of a resolution-independent and vector-based rendering engine. It is further extended with a set of application-development features including Extensible Application Markup Language (XAML), controls, animation, styles, templates, and data binding of documents and media.

    The WPF architecture involves both managed code and native code. Most WPF components are managed code except "milcore" which is written in unmanaged code to allow tight integration with DirectX. In WPF, all display is done through the DirectX engine. This allows for efficient hardware and software rendering.

    Data binding in WPF is completely different from traditional applications. In the traditional approach, the applications create a display and then bind to some data. In WPF every aspect of the control and display is generated by some sort of data binding. This data binding in WPF offers many advantages over traditional models, like flexible UI representation of data and a clear separation between the user interface and the business logic.

    If you are interested in more details of WPF architecture you can go through this MSDN document at Microsoft.

    What is XAML, and what has it to do with WPF?

    XAML stands for Extensible Application Markup Language. In WPF it is used as a markup language to define the UI (user Interface) elements. XAML is not a part of WPF. Rather it is a larger language concept than WPF and is used in many other contexts beyond WPF. In WPF, controls and code are represented by XAML with the help of C#, Visual Basic, and other .NET Framework languages.

    Which Operating Systems does WPF Support?

    Windows Vista, Windows XP SP2, and Windows 2003 Server.

    Development using WPF

    With WPF, it is possible to create any of the following type of applications:

    Standalone Applications : Windows executables.

    XAML browser applications (XBAPs): WPF applications that run in a browser (Windows Internet Explorer, with WPF 3.5, it is possible to run XBAPs in Firefox also).

    Custom Control Libraries: Non-executable assemblies containing reusable controls.

    Class Libraries: Non-executable assemblies containing reusable classes.

    The most common development environments used for WPF development are Microsoft Visual Studio and Microsoft Expression Blend. Microsoft Expression Blend is a tool to implement and share XAML markup which is aimed primarily at designers, but if you are a developer, Visual Studio is better suited for you.


    For programmers with .Net programming experience, WPF should be familiar as it is a subset of .NET (located mostly in the System.Windows namespace). You can create a WPF application using the .NET Framework programming language of your choice like or C#. WPF offers the ability to develop an application using both markup and code-behind. Generally XAML is used to implement the appearance (UI) of an application and its behavior is implemented using managed programming languages (code-behind). So the foundation of WPF application development involves the .Net Framework, System.Windows, markup, and code-behind.

    Tools for WPF Developments

    Microsoft Visual Studio 2008

  • slide 2 of 3


    WPF Application in Visual StudioWPF Application in Expression Blend 2