An Overview Of WPF Architecture

In continuation of my previous article “ABCs of WPF”, I am going to discuss the architecture of WPF. There is architecture behind every language. We are not going in depth to understand each and every thing. I suggest you to go through the basics of WPF by your own created samples. It would help you understand the each layer of WPF in detail.

The architecture of WPF can be classified into three layers,

  1. Managed Layer
  2. Unmanaged Layer
  3. Core API Layer

(Image is taken from Google)

Managed Layer

This layer contains Presentation Framework and the Presentation Core, which is basically part of .Net framework and written in managed code, hence called managed layer. All the managed code management is managed by CLR itself. Basically, three DLL files -PresentationFramework.dll, PresentationCode.dll, and WindowsBase.dll build the make part of WPF Architecture.

On creating the WPF application, you will see these into the solution file.

PresentationFramework.dll

This DLL consists of all classes that are required to create the WPF UI. This wraps up the controls, data bindings, styling, shapes, media, documents, annotations, animation and more.

On exploring

 

PresentationCore.dll

Presentation Core acts as a managed wrapper around MILCore and provides a public interface for MIL. This is a low-level API exposed by WPF providing features for 2D, 3D, geometry and so on. Presentation Core provides classes for creating application visual tree. The Visual System creates a visual tree which contains applications Visual Elements and rendering instructions. PresentationCore.dll is responsible for this purpose.

On exploring

 

WindowsBase.dll

WindowsBase.dll assembly holds the most basic and most important types in WPF like DependencyObject, DependencyProperty, DispatcherObject and DispatcherTimer.

These classes are the base of WPF. The main classes exist in System.Windows namespace and System.Windows.Threading namespaces.

On exploring

 

Unmanaged Layer

This layer has two segments.

  • MilCore
  • WindowsCodecs

This layer is also called MilCore (Media Integration Library).

MilCore (Media Integration Library)

Milcore is a part of the unmanaged code which allows tight integration with DirectX (responsible for display and rendering). All rendering of controls in WPF is done through DirectX engine. DirectX is a collection of API developed by Microsoft for graphics, 2D, 3D programs.

WindowsCodecs

WindowsCodecs provides Imaging support in WPF. Image display, processing, scaling and transform are all handled by WindowsCodecs

Core API Layer

This layer has OS core components like Kernel, User32, GDI, Device Drivers, Graphic cards etc. These components are used by the application to access low-level APIs. User32 manages memory and process separation.

  • 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.

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now