Pages

WPF Tutorial: Introduction to WPF

Tuesday, February 19, 2013

Windows Presentation Framework (WPF) is a next generation presentation framework for building stunning windows client application. WPF is developed by Microsoft and is a computer-software subsystem that is vastly used for rendering user interfaces in windows based applications. WPF was initially released as a part of .NET Framework 3.0. Rather than relaying on older USER32 and GDI32 subsystem, WPF utilizes DirectX for rendering user interfaces.

Features

WPF comes with a lots of feature to create complex and rich user applications.
  • Vector based rendering 
  • Hardware Accelerated graphics engine (Direct3D)
  • Declarative UI using XAML
  • Data binding feature
  • Control and Data template 
  • XPS documents
  • Animation and timeline

Architecture

For every new technology, it is very essential to have clear idea about its architecture. As mentioned earlier, WPF is actually a set of assemblies that build up the entire framework. These assemblies can be categorized as
  • Managed Layer 
  • UnManaged Layer 
  • Core API 

Managed Layer : 

Managed layer of WPF is built using a number of assemblies. These assemblies build up the WPF framework, communicates with lower level unmanaged API to render its content. The few assemblies that comprise the WPF framework are :
  1. PresentationFramework.dll : Creates the top level elements like layout panels, controls, windows, styles etc. 
  2.  PresentationCore.dll : It holds base types such as UIElement, Visual from which all shapes and controls are Derived in PresentationFramework.dll. 
  3. WindowsBase.dll : They hold even more basic elements which are capable to be used outside the WPF environment like Dispatcher object, Dependency Objects. I will discuss each of them later.

Unmanaged Layer : 

The unmanaged layer of WPF is called MIL or Media Integration Library Core. It basically translates the WPF higher level objects like layout panels, buttons, animation etc into textures that Direct3D expects. It is the main rendering engine of WPF.

Core API: 

Core level API of WPF is consists of some unmanaged dll files those are part of the kernel. The few assemblies that compromise the WPF framework Core API layers are:
  1. Direct3D : It is the low level API in which the graphics of WPF is rendered. 
  2. User32 : It is the primary core api which every program uses. It actually manages memory and process separation. 
  3.  GDI & Device Drivers : GDI and Device Drivers are specific to the operating system which is also used from the application to access low level APIs.
WPF architecture. Blue elements are Windows components; brown ones are WPF components
Although WPF spans thorough both managed and unmanaged code components, application can only use public API via managed code.

No comments:

Post a Comment