Author : Admin
Last Modified : 07-Dec-2019
Complexity : Beginner

Features of WPF


Feature
  • 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

windows and elements of WPF are measured using the 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 scalable 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 separated 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. e.g
Say, for instance, you have a CheckBox, which has a Rectangle in it and a ContentPresenter (one where the caption of the TextBox 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.

Declarative Programming

WPF provides 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).

Separation of Appearance and Behavior

WPF separates the appearance of a user interface from its behaviour. The appearance is generally specified in the Extensible Application Markup Language (XAML), the behaviour is implemented in a managed programming language like C# or Visual Basic. The two parts are tied together by data binding, events and commands. The separation of appearance and behaviour 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 the content of another. Although this flexibility sounds horrible to designers, it is a very powerful feature if you use it appropriately. Put an image into a button to create an image button, or put a list of videos into a combo box to choose a video file.

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