Wednesday, August 28, 2013

Features of WPF

  • Device Independent Pixel (DPI)/Independent of screen resolution/Resolution Independent
  • Built-In Support for Graphics and Animation
  • Highly Customizable/Redefine Styles and Control Templates
  • Resource based Approach for every control
  • New Property System 
  •  Binding Capabilities
  • Declarative Programming
Device Independent Pixel (DPI)/Independent of screen resolution/Resolution Independent  

A WPF windows and elements are measured using device independent unit, A single device independent unit is defined as 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.

Built-In Support for Graphics and Animation

WPF using DirectX for rendering the elements, it has major support of graphics and animation capabilities.
Set of classes provided by WPF to deal with the  animation and graphics.

Highly Customizable/Redefine Styles and Control Templates 

WPF provides a huge flexibility to define styles and ControlTemplets.
In WPF ,Styles can be completely seperated from UIElement, You can just define it once and can change the look and feel of any control by using it with the element.

WPF gives the flexibility to the change the appearance of whole control itself by using ControlTemplests.
Say for instance, you have a Check Box, which has a Rectangle in it and a ContentPresenter (one where the caption of the Text Box appears). Thus you can redefine your checkbox and put a ToggleButton inside it, so that the check will appear on the ToggleButton rather than on the Rectangle.

New Property System

WPF introduces a new property system i.e. Dependency Property.
Every element of WPF defines a large number of dependency properties. The dependency properties have strong capabilities than the normal properties.

Data Binding

Declarative Programming

WPF provide the capability to the developer to define the rich client UI in a declarative way.
Tasks like defining a template for a control, creating a control hierarchy and similar work would be much easier if it is done in a declarative fashion. In WPF declarative programming was made possible with the introduction of Extensible Application Markup Language (XAML).

Seperation 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.
    <StackPanel Orientation="Horizontal">
        <Image Source="speaker.png" Stretch="Uniform"/>
        <TextBlock Text="Play Sound" />