Saturday, December 12, 2009

WPF an Introduction


ShareThis
WPF is Microsoft's unified presentation subsystem for Windows and is
exposed through .NET Framework v3.0, Windows Vista's managed-code
programming model.

Windows Presentation Foundation (WPF) consists of a display engine that
takes full advantage of modern graphics hardware and an extensible set of
managed classes that development teams can use to create rich, visually
stunning applications. WPF also introduces Extensible Application Markup
Language (XAML), which enables developers and designers to use an XML-based
model to declaratively specify the desired user interface (UI) behavior.

Windows Presentation Foundation provides a unified approach to user
interface, 2D and 3D graphics, animation, documents and media. It allows
designers to be an integral part of the application development process.

Since the initial release of the .NET Framework, many applications have
been created using Windows Forms. Even with the arrival of WPF, some
applications will continue to use Windows Forms. For example, anything that
must run on systems where WPF isn't available, such as older versions of
Windows, will most likely choose Windows Forms for its user interface. New
applications might also choose Windows Forms over WPF for other reasons,
such as the broad set of controls available for Windows Forms.

Letting WPF applications use these existing controls can make sense in some
cases. Conversely, WPF offers many things that Windows Forms does not, such
as 3D graphics and animations. Allowing an existing Windows Forms
application to incorporate parts of WPF's functionality also makes sense.

Both of these things are possible. A WPF application can host Windows Forms
controls, and a Windows Forms application can host WPF controls. A user can
interact with WPF dialogs and Windows Forms dialogs in the same
application, typically without being aware that there's any difference.

To host Windows Forms controls, a WPF application relies on WPF's
WindowsFormsHost control. Similarly, a Windows Forms application uses
ElementHost, a Windows Forms control that's capable of hosting WPF
controls, panels, and other elements.

The tools for each technology can also work with software written for the
other. WPF's Visual Designer can be used to position Windows Forms
controls, while the Windows Forms designer can be used to position WPF
controls.

Using WPF and Windows Forms together does have some restrictions. Layering
a WPF control on top of a Windows Forms control won't work, for example;
the Windows Forms control will always be on top. WPF's transparency effects
also won't work well with Windows Forms controls, nor will WPF
transformations. And because the WindowsFormsHost and ElementHost controls
require full trust, a WPF application that uses them can't run as an XBAP.
Still, a large percentage of Windows applications can use both WPF and
Windows Forms to create their user interface.

This Text is an extract from this post written by Linda Liu.


0 comments: