Monday, 24 September 2012

WPF Architecture

Before we jump into creating our WPF application, it's good idea to understand overall architecture of WPF, major components in WPF architecture and how components interact with each other.

Here is an overall architecture diagram of WPF.

As we can see in above diagram that WPF architecture is a layered architecture having Managed, Unmanaged and core operating system layers. Managed components are exposed as public API and Unmanaged components provides low level functionality of rendering WPF application.

3 major components in WPF architecture are as below.

PresentationFamework

PresentationFamework is a managed component. PresentationFamework sits on the top of architecture framework and is the primary API for creating WPF applications. PresentationFamework provides functionality that we need to build the WPF applications such as controls, data bindings, styling, shapes, media, documents, annotations, animation and more. When we create any WPF project, PresentationFamework.dll is added as reference by default.

PresentationCore

PresentationCore is a managed wrapper around Media Integration Layer and provides public interface for MIL. PresentationCore is the home for WPF Visual System and provides classes for creating application visual tree. The Visual System creates visual tree which contains applications Visual Elements and rendering instructions. Visual System does not render UI but passes rendering instruction, one element at a time to Composition System of MilCore through 2 way Message Transport. When we create any WPF project, PresentationCore.dll is added as reference by default.

MilCore

MIL in MilCore stands for Media Integration Layer. MilCore provides low level rendering functionality for WPF application. MilCore is written in Unmanaged code in order to enable tight integration with DirectX. DirectX engine is underlying technology used in WPF to display all graphics, allowing for efficient hardware and software rendering. MIL has Composition System that receives rendering instructions from Visual System and translates into data that can be understood by DirectX to render user interface.

I hope this article was useful to understand overall WPF architecture.

1 comment: