An Overview of WPF Architecture

Introduction:
Windows Presentation Foundation (or WPF) is a graphical subsystem for rendering user interfaces in Windows-based applications by Microsoft. Windows Presentation Framework 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. It includes application UI, 2D graphics, 3D graphics and multimedia. It takes advantage of hardware acceleration of modern graphic cards. WPF makes the UI faster, scalable and resolution independent.
WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0. Rather than relying on the older GDI subsystem, WPF uses DirectX.


Overview of Windows Presentation Foundation

The architecture of WPF is actually multilayered architecture. It spans across three layers – Managed code, Unmanaged code and Core operating system, we can call these layers as set of assemblies that built up the entire framework. The major components of WPF are illustrated in below wpf diagram.-

WPF – Architecture of WPF
WPF – Architecture of WPF

 Presentation Framework, Presentation Core and Media Integration layer (milCore) are the three major components of WPF architecture. These are the major code portions of WPF and plays a vital role in an overview of Windows Presentation Foundation. MilCore is written in UnManaged code in order to enable tight integration with DirectX. DirectX engine is responsible for all visual effects in WPF, allowing for efficient hardware and software rendering. CLR provides the fine control over memory and execution. The composition engine in milCore is extremely performance sensitive, and required giving up many advantages of the CLR to gain performance.

Managed Layer

The public API exposed is only via this layer. Major portion of the WPF is in managed code.

    1- PresentationFramework.dll :- It holds the top level WPF elements, including those that represents Windows, panels, controls, styles etc. It also implements the end-user presentation features including time-dependent, story-based animations and data binding.


    2- PresentationCore.dll :- Presentation Core provides a managed wrapper for MIL and implements the core services for WPF such as UI Element and visual from which all shapes and controls derived in PresentationFramework.dll.


    3- WindowsBase.dll :- Holds more basic elements which are capable to be reused outside the WPF environment like Dispatcher objects and Dependency objects.



UnManaged Layer

    1- milCore.dll :- While the majority of WPF is in managed layer, the composition engine which renders the WPF application is a native component. It is called as 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. It is the main rendering engine of WPF and is interface between DirectX and CLR.


    2- WindowsCodecs.dll :- WindowsCodecs is another low level API which is used for imaging support in WPF applications like image processing, image displaying and scaling etc. It comprises of a number of codecs which encode/decodes images into vector graphics that would be rendered into WPF screen.




Core operating System Layer (Kernel) OR API Layer

    1- DirectX :- DirectX is the low level API through which WPF renders all graphics.


    2- User32 :- It the primary core API which every application uses. User32 actually manages memory and process separation.



To understand overview of Windows Presentation Foundation we should know that all WPF applications start with two threads – one is for managing the UI and another background thread is to handle the rendering and repainting. Rendering and repainting is managed by WPF itself and doesn’t require any developer intervention.


Ashwani
Ashwani

This is a short biography of the post author. Maecenas nec odio et ante tincidunt tempus donec vitae sapien ut libero venenatis faucibus nullam quis ante maecenas nec odio et ante tincidunt tempus donec.

No comments:

Post a Comment