Window Presentation Framework is Microsoft tools for website
development and rich client applications. It is previously known as Avalon. WPF
is an approach of Microsoft to a GUI framework.
If you have to use Forms and Controls, Windows form is best
for that, for fixed format document pdf is good, for Image GDI_ is better, For
Audio and Video Windows Media Player is nice, for two dimensional graphics GID+
is right, for three dimensional graphics Direct3D is wonderful but what if you
have use all the feature in single platform, WPF is comes in scene for that.
Difference between WPF, GDI, GDI+, and DirectX?
GDI application use
Operating System Controls to build its application, which are very hard to
customize. WPF controls are drawn on
screen, which are easy to customize.
WPF is not a
replacement for DirectX but for Windows Forms.
Features
1.
Fixed and Flow format documentation.
2.
Device Independent Pixel Format.
3.
Window Form use Pixel based approach , when DPI change than controls
also change their size and look while WPF control are DPI independent
Suppose
you have drawn a 2 inch box and you were working with 96 DPI screen if you see
the same application in 120 DPI screen the will appear relatively small.
Because screen are dependent on DPI setting
While
WPF uses density based approach, So when the density of pixel has been changed
the element will adjust them accordingly, if you will repeat the above scenario
with WPF application than box size will not change, hence it takes more pixel
in case of 120 DPI application to adjust the size properly.
4.
All the capabilities of HTML and Flash.
5.
2D and 3D vector graphics.
6.
Animation
7.
Multimedia
8.
Data Binding
WPF use XAML
(Extensible Application Markup Language);
XAML is
compiled into IL (just like C# or VB)
Advantage of WPF over Window Form
1.
Common Look and Feel
2.
Anywhere Execution
3.
Binding
4.
Directive Programming (i.e. Less Code)
5.
Graphic Independency
6.
Faster execution (Hardware Rendering)
7.
Expression Blend and Animation
8.
Built in Support for Graphics and Animation: - WPF application are rendered within DirectX
environment. There graphics here are vector based, figure drawn here act as an
object you can select the rectangle drawn in WPF and delete also unlike
traditional rectangle in drawn in Windows form using GDI.
XAML can be used in
WPF, WWF and in Silverlight.
Architecture of WPF
Above figure shows
the architecture of WPF. There are three main component of WPF shown with gray
color
1.
Presentation Framework 2.
Presentation Core 3. MilCore.
The figure shows
how direct x and operating system contact with other components.
Let’s see what the different
components do.
User32: User32 determine what goes where on the
screen.
Direct X: WPF internally uses direct X. On the other side DirectX talks with
drivers and renders the content.
Milcore: Media Integration Library, It is a manage
code that works like a bridge between WPF managed code and User32.
Presentation
Core: This is a low level
API exposed by WPF that provide features like 2D, 3D and geometry.
Presentation
Framework: User directly
contact with Presentation Framework. It contains Layout, Controls, and Contents
etc.
System.Threading.DispatcherObject
System.Threading.DispatcherObject
The base
class of all WPF object is DispatcherObject. WPF support SingleThreadedApartment
model. DispatcherObject mainly handles concurrency and threading. Messages like
button clicks, mouse clicks are first send to DispatcherObject, It verifies whether
code is running on same thread.
Are XAML Files complied or built at runtime?
XAML files
are not generally parsed at runtime, they are complied. But they can parsed
also. A Xaml based project creates .g.cs file for every .xaml file after
building inside obj\Debug folder.
No comments:
Post a Comment