Introduction:
In this article i will give you an overview regarding architecture of WPF(Windows Presentation Foundation). In this article you will get to know Managed layers and UnManaged layers of WPF base framework . And you will know Object Hierarchy of WPF Controls.
Description:
We all know as WPF was introduced in .Net 3.0 Framework. WPF was designed to create dynamic, data driven systems. Every part of the system is designed to create objects through property sets which drives behaviour. Data Binding is the fundamental part of the system which is integrated with every layer.
Generally applications create display and then bind to some data. But in WPF Everything about the control, every aspect of the system is generated by some sort of binding. Generally text inside a button is displayed by creating a composed control inside a button and binding it's display to button's content property. In the same manner only for all controls. If you deeply investigate the architecture of WPF you will know that WPF Applications are data driven.
WPF Architecture:
WPF architecture is multilayered architecture. It has three layers mainly 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 are below Presentation Framework,
Presentation Core and Media Integration(Milcore) are the major components of wpf
architecture. Milcore is written in
unmanaged code in order to enable integration with DirectX. DirectX engine is responsible for all display
in WPF, allowing for efficient hardware and software rendering. And CLR
Provides control over memory and execution.
The Composition engine in milcore is extremely very good in performance
and required giving up many advantages of the CLR to gain performance.
Managed Layer:
Managed
layer of WPF is built using number of assemblies. These assemblies build up the
WPF framework, and communicate with lower level unmanaged API to render its
content.
Few Assemblies in
WPF Framework are
1.
PresentationFramework.dll: It creates the top
level elements like layout panels(Canvas,Grid,StackPanel,etc), Controls,
Windows, styles etc.
2.
PresentationCore.dll: It holds base types such as UIElement, Visual
from which all shapes and controls are derived in PresentaitonFramework.dll.
3 . WindowBase.dll: They hold even more basic
elements which are capable of being used outside the WPF environment like
Dispatcher.
Unmanaged Layer(milcore.dll):
We can call this unmanaged layer
as Media Integration Library Core which translates the WPF higher level object
like layout panels, buttons, animation, etc using Direct3D rendering engine of
WPF.
WindowsCodecs.dll: This is low
level API which gives imaging support in WPF applications.
WindowsCodes.dll: consists of a number of
codecs which encode/decode images into vector graphics which will rendered into
WPF screen.
Direct3D: It is low level API
using which graphics of WPF is rendered.
User32: It is primary core API
which every program uses. It manages memory and process separation.
GDI & Device Drivers: GDI and
Device Drivers are Specific to the operating system which used from application
to access low level APIs.
Object Hierarchy:
Before you develop your first wpf application it is better to know the Object hierarchy of WPF controls. This hierarchy is common for every control in wpf.
Figure shows Object Hierarchy of WPF Controls
In the above image all abstract classes are rendered as ellipses and concrete classes are rendered as Rectangles.
Dispather Object: Mother of all WPF controls which takes
care of UI thread.
DependencyObject: Which builds the Observer for Dependency
Properties.
Visual: Which links
between managed libraries and milcore.
UIElement: This adds feature like layout, input, events,
etc.
FrameworkElement: Implementation of UIElement.
Shape: This is base class of all the basic shapes.
Control: UIElemets for user interaction. It can be templated
or formatted to change look.
ContentControl: Base class of all controls that have single
content.
ItemsControl: Base class for all controls that show a
collection.
Panel: Base class of all panels or containers.
Conclusion:
I hope you got an idea on the architecture of wpf. In my next article i will explain differences between Windows Forms and WPF and Features of WPF over Windows Forms.
Don't forget to Comment and Share for Our friends if you like this post. Thank You.
Don't forget to Comment and Share for Our friends if you like this post. Thank You.
Related Tutorials
- How to work with or How to Consume 3 layered architecture of .Net Application.
- Creation of Three Tier Architecture in .Net Application.
- Difference between App.config and Web.Config
- Asp.Net Validation Controls Tutorial
- Asp.Net Ajax Tutorials
- Difference between Machine.Config and Web.Config in Asp.Net Framework.
Hi can i use wpf in web application
ReplyDeletehi
ReplyDeleteWe can develop web applications using wpf i.e WPF XBAP Applications.
ReplyDeleteWe can't use wpf along with Web Applications frameworks like Asp.Net and MVC, WPF itself provides a way to develop web applications.
You can find more details on how to develop wpf web applications at MSDN
http://msdn.microsoft.com/en-us/library/aa480223.aspx.