Overview of Windows Presentation Foundation (WPF) Architecture

Introduction 

This article provides an overview of the Windows Presentation Foundation (WPF) architecture. WPF is a next-generation UI framework to create applications with a rich user experience. It is part of the .NET Framework 3.0 and higher.

WPF has a rich and extensible architecture for designing rich UI applications.

Your WPF applications need to have a planned architecture for the elements that you will use in your application.

To learn more about the Windows Presentation Foundation(WPF), we must have a clear undersanding of the WPF architecture. So let's get an overview of the WPF architecture.

Overview of Windows Presentation Foundation

The architecture of WPF is actually a multilayered architecture. It has mainly three layers, the WPF Managed Layer, the WPF Unmanaged Layer and the Core operating system element, basically these layers are a set of assemblies that rovide the entire framework.

The major components of WPF are illustrated in the following WPF diagram:

WPF Components

Now I will explain each layer one by one.

Managed Layer

The Presentation Framework, Presentation Core and Window Base are the three major components of the Managed Layer. These are the major code portions of WPF and plays a vital role in an overview of Windows Presentation Foundation. The public API exposed is only via this layer. The Major portion of the WPF is in managed code.

  • PresentationFramework.dll: This section contains high-level features like application windows, panels, styles controls, layouts, content and so on that helps us to build our application. It also implements the end-user presentation features including data binding, time-dependencies, animations and many more.

  • PresentationCore.dll: This is a low-level API exposed by WPF providing features for 2D, 3D, geometry and so on. The Presentation Core provides a managed wrapper for MIL and implements the core services for WPF such as UI Element and visual . The Visual System creates visual tree that contains applications Visual Elements and rendering instructions.

  • WindowsBase.dll: It holds the more basic elements that are capable to be reused outside the WPF environment like Dispatcher objects and Dependency objects.

UnManaged Layer

  • milCore.dll: The composition engine that renders the WPF application is a native component. It is called the Media Integration Layer (MIL) and resides in milCore.dll. The purpose of the milCore is to interface directly with DirectX and provide basic support for 2D and 3D surface. This section is unmanaged code because it acts as a bridge between WPF managed and the DirectX / User32 unmanaged API.

  • WindowsCodecs.dll: WindowsCodecs is another low-level API for imaging support in WPF applications like image processing, image displaying and scaling and so on. It consists of a number of codecs that encode/decode images into vector graphics that would be rendered into a WPF screen.

Core operating System Layer (Kernel)

This layer has OS core components like User32, GDI, Device Drivers, Graphic cards and so on. These components are used by the application to access low-level APIs.

  • DirectX: DirectX is the low-level API through which WPF renders all graphics. DirectX talks with drivers and renders the content.

  • User32: User32 actually manages memory and process separation. It is the primary core API that every application uses. User32 decides which element will be placed where on the screen.

  • GDI: GDI stands for Graphic Device Interface. GDI provides an expanded set of graphics primitives and a number of improvements in rendering quality.

  • CLR: WPF leverages the full .NET Framework and executes on the Common Language Runtime (CLR).

  • Device Drivers: Device Drivers are specific to the operating system. Device Drivers are used by the applications to access low-level APIs.

Up Next
    Ebook Download
    View all
    Learn
    View all