Re: WPF--a threat to WinForms?



On Aug 24, 7:31 pm, JDeats <Jeremy.De...@xxxxxxxxx> wrote:

WinForms is less threatened by WPF because of the nature of WinForms
applications. In my opinon Enterprise desktop applications already
have a very rich framework with WinForms and quite effective set of
controls to get the job done. From an architecture perspective I don't
see WPF having a lot to offer over WinForms to most enterprise desktop
application developers, but Enterprise web applications certainly
could benefit from the paradigm WPF offers, it's a very dramatic,
empowering shift for a web developer.

WPF on the desktop just gives developers wanting to unify the web and
desktop experience an option. Over time it will probably replace
WinForms, but I could see WinForms sticking around for a few
generations.

JDeats--you'll be interested by the below extract on the benefits of
WPF over WinForms. But the problem I have is that I just fired up
VS2008 and wrote a 'hello world' program, and found to my chagrin:
WPF has no "lightning bolt" to pick from an array of Event Handlers
(*noted by others as well, see below*), rather, you simply double
click on a control and a 'default' event handler arises (such as
double clicking on a button will give a "_Click" handler). This is
because the controls in WPF do not have as rich a set of EventHandlers
as in WinForms. For example, with a label, you cannot use it for
debugging by writing "label1.Text = myObject.ToString()" for example--
the .Text extension method does not exist for label. A minor point,
but I only spent five minutes in WPF and have concluded it's still
beta-ware--apparently a better programming interface called "Blend"
was released about three months ago by MSFT, in an attempt to overcome
this, but I think the 'steep learning curve' associated with WPF is
because of the rewrite of the library, which is not like WinForms or
MFC. Also you need to have a dual monitor IMO to program WPF--they
back more information than can fit in one screen. Of course dual
monitors are always a good idea in programming.

*See here: http://forums.msdn.microsoft.com/en-US/wpf/thread/c08b83dd-e9b7-49b5-86d2-291ba9ed04ab/

RL

From the excellent book: C#3.0 in a Nutshell by Albahari et al.
(O’Reilly), p. 166.

Windows Presentation Foundation (WPF)

WPF is a rich client technology new to Framework 3.0. Framework 3.0
comes preinstalled on Windows Vista-and is available as a separate
download for Windows XP SP2.

The benefits of WPF are as follows:
It supports sophisticated graphics, such as arbitrary transformations,
3D rendering, and true transparency.
Its primary measurement unit is not pixel-based, so applications
display correctly at any DPI (dots per inch).
It has extensive dynamic layout support, which means you can localize
an application without danger of elements overlapping.
Rendering uses DirectX and is fast, taking good advantage of graphics
hardware acceleration.
User interfaces can be described declaratively in XAML files that can
be maintained independently of the "code-behind" files-this helps to
separate appearance from functionality.

Here are its limitations:

The technology is less mature than Windows Forms or ASP.NET. Its size
and complexity make for a steep learning curve.
Your clients must run Windows Vista-or Windows XP with Framework 3.0
or later.

The types for writing WPF applications are in the System. Windows
namespace and all subnamespaces except for System. Windows . Forms.

Windows Forms

Windows Forms is a rich client API that-like ASP.NET-is as old as
the .NET Framework. Compared to WPF, Windows Forms is a relatively
simple technology that provides most of the features you need in
writing a typical Windows application. It also has significant
relevancy in maintaining legacy applications. It has a number of
drawbacks, though, compared to WPF:

Controls are positioned and sized in pixels, making it easy to write
applications that break on clients whose DPI settings differ from the
developer's.
The API for drawing nonstandard controls is GDI+, which, although
reasonably flexible, is slow in rendering large areas (and without
double buffering, flickers horribly).
• Controls lack true transparency.
Dynamic layout is difficult to get right reliably.
The last point is an excellent reason to favor WPF over Windows Forms-
even if you're writing a business application that needs just a user
interface and not a "user experience." The layout elements in WPF,
such as Grid, make it easy to assemble labels and text boxes such that
they always align-even after language changing localization—even
without messy logic and without any flickering.

Further points made on the next page: WPF is faster, since GDI+
hardware accelerators never became popular with manufacturers, who
chose DirectX. Thus GDI+ is actually “considerably slower” than GDI,
let alone WPF.

On positive side, Windows Forms relatively simple to learn and has
third-party support.


RL
.