WPF Architecture

WPF  wpf 

WPF is a successor of Windows Forms. Earlier Windows Forms uses the Windows Graphics Device Interface (GDI+) for rendering any graphics, and drawing text. WPF is a new framework for developing rich Windows smart client applications that uses the DirectX technology behind the scene. WPF is resolution-independent because WPF uses vector graphics for drawing the controls on the screen. For example, a simple Checkbox control in WPF contains its vector graphics instructions that describe the render definition of control. WPF uses the hardware acceleration for better graphics and better performance.

WPF Architecture

WPF Architecture consists of two layers:

  1. Managed Layer
  2. Unmanaged Layer

Managed Layer: Managed Layer composed of three assemblies:

  1. WindowsBase
  2. PresentationFramework
  3. PresentaionCore

1. WindowsBase: WindowsBase assembly defines the most basic and most important types in WPF like DependencyObject, DependencyProperty, DispatcherObject, DispatcherTimer.These classes are the base of WPF. The main classes exists in System.Windows namespace and System.Windows.Threading namespaces.

2. PresentationCore: PresentationCore provides a managed wrapper around unmanaged code(MilCore) used in WPF. It contains all the basic visual types in WPF. PresentationCore contains the UIElement class from which all the visual controls inherit.

3. PresentationFramework: PresentationFramework contains all the UI controls like Button, CheckBox, TextBlock, Label, TextBox etc. and Application class, DataTemplate class, ControlTemplate class, All types of Triggers, Binding classes, and all important classes for developing the UI of WPF application.

Unmanaged Layer: Managed Layer composed of two DLLs:

  1. MilCore
  2. WindowsCodecs

1. MilCore(Media Integration Library): MilCore DLL contains the unmanaged code written for direct interaction with DirectX. 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. Direct allows you to write hardware independent instructions.

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

Join our newsletter and get an occasional email with a technology and dotnetpattern.com news update.