Bookmark and Share Share...    Subscribe to this feed Feed   About Christian Moser  


Introduction to Windows Presentation Foundation

Overview

The Windows Presentation Foundation is Microsofts next generation UI framework to create applications with a rich user experience. It is part of the .NET framework 3.0 and higher.

WPF combines application UIs, 2D graphics, 3D graphics, documents and multimedia into one single framework. Its vector based rendering engine uses hardware acceleration of modern graphic cards. This makes the UI faster, scalable and resolution independent.

The followinig illustration gives you an overview of the main new features of WPF

Separation of Appearance and Behavior

WPF separates the appearance of an user interface from its behavior. The appearance is generally specified in the Extensible Application Markup Language (XAML), the behavior is implemented in a managed programming language like C# or Visual Basic. The two parts are tied together by databinding, events and commands. The separation of appearance and behavior brings the following benefits:

  • Appearance and behaviour are loosely coupled
  • Designers and developers can work on separate models.
  • Graphical design tools can work on simple XML documents instead of parsing code.

Rich composition

Controls in WPF are extremely composable. You can define almost any type of controls as content of another. Although these flexibility sounds horrible to designers, its a very powerful feature if you use it appropriate. Put an image into a button to create an image button, or put a list of videos into a combobox to choose a video file.

 
<Button>
    <StackPanel Orientation="Horizontal">
        <Image Source="speaker.png" Stretch="Uniform"/>
        <TextBlock Text="Play Sound" />
    </StackPanel>
</Button>
 
 

Highly customizable

Because of the strict separation of appearance and behavior you can easily change the look of a control. The concept of styles let you skin controls almost like CSS in HTML. Templates let you replace the entire appearance of a control.

The following example shows an default WPF button and a customized button.

Resolution independence

All measures in WPF are logical units - not pixels. A logical unit is a 1/96 of an inch. If you increase the resolution of your screen, the user interface stays the same size - it just gets crispier. Since WPF builds on a vector based rendering engine it's incredibly easy to build scaleable user interfaces.





Last modified: 2011-08-15 18:49:42
Copyright (c) by Christian Moser, 2011.

 Comments on this article

Show all comments
Pham Kien Quoc
Commented on 17.September 2011
Very useful for beginner in just 5 min .
Thanks a lot.
pragati
Commented on 19.September 2011
very good...
Haritha
Commented on 19.September 2011
It really gud :)
bhanu
Commented on 20.September 2011
Good one
sreejith
Commented on 20.September 2011
Thank you..I think its more helpful for the beginners in WPF
Amit Verma
Commented on 20.September 2011
very helpful and easy to understand
Abu Hanin
Commented on 20.September 2011
Similar to MSDN documentation but looks nicer &amp; richer
kartik
Commented on 21.September 2011
there is an sql error on the tutorials like user desing process...please fix it out asap...thankyou
Sweta Pandey
Commented on 21.September 2011
Thanks Sir, thank you so much for all notes and example of WPF.........
Dhruvangini
Commented on 22.September 2011
It is so beautifully explained that any one can understand.
Thanks
BoYu Gao
Commented on 22.September 2011
that is wonderful
Mark
Commented on 22.September 2011
You really need a spellchecker and a proofreader. Crispier??
awesome
Commented on 22.September 2011
one word. AWESOME!
Garima
Commented on 23.September 2011
Very nice article for WPF Beginners...
sakthi
Commented on 23.September 2011
Pushing the beginners to mine more !!! .... Good
Garima
Commented on 23.September 2011
Very nice article for WPF Beginners...
RobertS
Commented on 24.September 2011
Cool.. been looking for a nice WPF intro and this is by far the best and coolest... thanks
anjali
Commented on 25.September 2011
This is very helpful to learn
chaitanya
Commented on 26.September 2011
This article has given nice introduction to the wpf beginners.
Mobashir Ahmad
Commented on 26.September 2011
Good Explaination
Roshan
Commented on 26.September 2011
really...good one
Nithya
Commented on 27.September 2011
Good one
Mukesh
Commented on 27.September 2011
What a intro?????
pradeep
Commented on 27.September 2011
very useful
deepak
Commented on 27.September 2011
thnxx sir nice intro

Name
E-Mail (optional)
Comment