Monday, January 26, 2009

Windows Presentation Foundation

WPF: Windows Presentation Foundation

Overview :

WPF is a tool comes as a package in Windows Vista and used to develop User interfaces effectively ,it provides several features to developer to develop dynamic data driven applications. It is used in both web based and stand alone applications.But mostly used in Web based application.

Windows Presentation Foundation (WPF) provides a set of services that can be used to extend the functionality of a common language runtime (CLR) property


Windows Presentation Foundation :
The core of WPF is a resolution-independent and vector-based implementation of graphics .
The extension of this along with Application development features like XAML(Extensible application Markup Language),Controls,databinding,Layout,2-D and 3-D graphics,animations,styles,templates,audio,video,
text, typography is WPF.

WPF reduces the amount of procedural code in application specifications.It provides us
ability to develop an application using both markup and code-behind.

Markup : Extensible Application Markup Language (XAML) markup to implement the appearance of an application

Code-behind : Managed programming languages (code-behind) to implement application behavior



The separation of logic from appearance has many advantages


Development and maintenance costs are reduced because appearance-specific markup is not tightly coupled with behavior-specific code.


Multiple design tools can be used to implement and share XAML markup, to target the requirements of the application development contributors;
Microsoft Expression Blend provides an experience that suits designers, while Visual Studio 2005 targets developers

Globalization and localization for WPF applications is greatly simplified




Many application services like User Interface, fixed documents, adaptive documents, 2D and 3D drawings, animation, audio, video etc. work together in unison under WPF. Microsoft Silverlight that is based on XAML and JScript is a web based subset of WPF. Silverlight helps develop web and mobile applications with codes similar to .NET applications and the applications are similar to Flash.

XAML is Extensible Application Markup Language .It simplifies creation of UI for the .NET Framework programming model.I will explain the details of XAML and its implementation in my next Blog.

Features :
--WPF offers all graphics as Direct3D applications,animations,effects,audio and video.

--Interoperability with Win32 is supported by WPF.

--WPF supports all the standard image formats and video formats like WMV, MPEG and AVI. WPF also supports time based animations, Open Type Font features and Text rendering

--WPF supports XML Paper Specification documents. It also supports reading and writing of paginated documents.

--WPF offers many built-in controls like button, list box etc.


Instantiatiation of classes, properties, calling methods, and event handling in WPF is similar to the one we did in Vb.net (as I am familiar only in vb.net I mentioned as vb.net J ,it is as similar as C# or Visual Basic) and windows forms.

WPF includes additional constructs that enhaces properties and events they are

-Dependency properties

-Routed events



Dependency Properties

Windows Presentation Foundation (WPF) provides a set of services that can be used to extend the functionality of a common language runtime (CLR) property. Collectively, these services are typically referred to as the WPF property system. A property that is supproted by the WPF property system is known as a dependency property.

The purpose of dependency properties is to provide a way to find out the value of a property based on the value of other inputs


Dependency property identifier:
A Dependency Property instance, which is obtained as a return value when registering a dependency property, and then stored as a member of a class. This identifier is used as a parameter in many of the APIs that interact with the WPF property system.

CLR "wrapper": The actual get and set implementations incorporate the dependency property identifier, thus providing the backing for the property using the WPF property system.


Routed Events

Routed events can be defined in 2 different perspectives either functionally or Technically

Functional definition: A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event.

Implementation definition: A routed event is a CLR event that is backed by an instance of the Routed event class and is processed by the Windows Presentation Foundation (WPF) event system.

Binding and manipulation of application data is supported by WPF through its built-in set of data services. Data templates for controlling data presentation are also provided by WPF.










1 comment: