WPF vs WinForms

A

Amir Tohidi

Hi

Apart from simple test harnesses, I haven't done much with WinForms. As for
WPF, I know what it stands for :)

Having Googled for a while, I couldn't find a no nonsense web site that
helps me understand where WinForm and WPF sit in the Microsoft world. For
example, is WPF the replacement for WinForms?

Please comment or point me to some decent articles. Please note that I am
mainly interested in these technologies from an Arcitecture point of view.
For example:

* Why would a company want to migrate an existing WinForms app to WPF (or is
that a silly question)

* If starting a new Windows application, what are the key considerations in
chossing between WinForms vs WPF

* Which environment is better suited for delivering functionaly rich GUI in
a RAD environment

Thanks
Amir
 
B

Bob Powell [MVP]

A company may wish to migrate an existing application to WPF to add a new
look to the application, or, if the application was an intensely graphical
one, to increase performance.

Architecturally, WPF applications and Windows Forms applications only have
about one thing in common, Databinding. Otherwise chalk and cheese is a good
analogy.

If you are starting a new application, I not wish to discourage you from a
WPF app but in my opinion the tools available for creating WPF applications
as well as the support from third-party suppliers for components and so on
is pretty poor at the moment. Having actually tried to create an industrial
strength application in WPF I found that it lacked the facilities I needed
and so went for CAB / Windows Forms solution with some WPF content hosted on
Windows Forms.

Personally, given the amount that Visual Studio 2008 crashes and the fact
that Blend 2.0 still isn't available I would hold off of starting any
serious project on a WPF platform and look at it as a learning thing.

If you need to deliver an application in a short time with good features and
support, go for a Windows Forms application while paying close attention to
your data model so that migration to WPF eventually is painless.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
A

Amir Tohidi

Hi Bob

Thanks for your insight and help.

Is there an article that discusses data binding related matters and compares
WinForms vs WPF data binding?

Thanks
Amir
 
A

ActiveX_IE

Hi Bob

I am about to develop Industrial automation application for commercial use.

I need to generate sine waveform. Please let me know if you can give
reference of existing applications developed for such use and code samples.

It could be using winforms or WPF any.

Please let me know what do you mean by
1) in my opinion the tools available for creating WPF applications
as well as the support from third-party suppliers for components and so on
is pretty poor at the moment.

2) WPF lacked the facilities I needed
 
K

Keith P

I'm a huge fan of WPF, so I'll throw out my impressions of it:
The primary advantage to it is that it doesn't sit on GDI like WinForms, so
you've got a vector-based UI that supports virtually any resolution, is
accelerated by the 3D card (GDI is accelerated but not to the extent that
vector-based systems can). It's a very declarative tech where most of the UI
eye candy is written on the page by the designer independent of the coder.
Also, the databinding is done in such a way that if you connect the property
of one control with another via an event handler (i.e. declare that the color
of a control's background is Blue if myButton.IsPressed, your control's
background will change to blue when pressed (and back to its original color
once the condition is false)...all the magic of DependencyProperty. This
means a TON of stuff that would have traditionally required writing event
handlers and having several code paths for buttons, etc., is all done inside
the WPF code automatically. This is also true for asynchronous databinding.
In a nutshell, if you say "IsAsynchronous=true" for your datasource
declaration, the dependency property it's bound to listens for the
OnDataBindComplete(or something like that...can't recall it right now), and
automatically updates from the proper thread while maintaining responsiveness.
And from a flexibility standpoint, its styling facilities are a radical
departure from WinForms. WPF apps have a logical tree (of buttons, grids,
etc) that have no inherent look to them; they just have functionality (a
button can be pressed, grid can hold stuff, a textbox has a Text property).
But they can look like whatever you want to define their template as. So for
example, if you want to draw a tab control, you could implement it as a radio
button group where each tab is a radiobutton because a tab control logically
functions like a radio button group.
 
B

Bob Powell [MVP]

I don't know of any article that specifically deals with the comparison of
these two data binding systems but effectively in the WPF model they threw
out almost everything _except_ the concept of databinding.

Objects must still implement INotifyPropertyChanged or provide a
<property>Changed event for each property.

WPF databinding is different inasmuch as the DataContext is inherited by
child controls whereas in Windows Forms the DataSource needs to be
explicitly set for each control.


--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
B

Bob Powell [MVP]

I'll explain my statements:

WPF controls provided by Microsoft are basic and definitely do not have the
functionality for creating industrial strength applications. Third party
support is on the increase with suppliers such as SyncFusion, Infragistics
and others providing early versions of component frameworks. These are
however late beta or early release versions and are not very evolved.

XAML is fantastic for creating a UI if you have the controls to hand that
you need and there are tricks you can use to "coerce" existing controls into
doing what you want but this is not universal or easy. The process of
actually creating a WPF control is very exacting and not at-all well
documented by Microsoft so the ability of the developer in the street to
create their own custom offerings is still limited. Early adopters have to
fight to obtain even the most basic information with blogs all dedicated to
the famous 12 line WPF bling-bling demo and very little real-meat for the
serious developer. I work in a serious financial environment and we are
contemplating the future with WPF and have come to the conclusion that it
isn't yet ready for prime-time but are confident that it will get there.
Anyway, when did any 1.0 framework ever come out of MS fully baked?

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
A

ActiveX_IE

Thanks for the info.
Let me know if you know application of WPF in industrial automation.
Please let me know if you have generated sine waveform using WPF.
 
R

Robert

Keith P said:
I'm a huge fan of WPF, so I'll throw out my impressions of it:
The primary advantage to it is that it doesn't sit on GDI like WinForms, so
you've got a vector-based UI that supports virtually any resolution, is
accelerated by the 3D card (GDI is accelerated but not to the extent that
vector-based systems can). It's a very declarative tech where most of the UI
eye candy is written on the page by the designer independent of the coder.
Also, the databinding is done in such a way that if you connect the property
of one control with another via an event handler (i.e. declare that the color
of a control's background is Blue if myButton.IsPressed, your control's
background will change to blue when pressed (and back to its original color
once the condition is false)...all the magic of DependencyProperty. This
means a TON of stuff that would have traditionally required writing event
handlers and having several code paths for buttons, etc., is all done inside
the WPF code automatically. This is also true for asynchronous databinding.
In a nutshell, if you say "IsAsynchronous=true" for your datasource
declaration, the dependency property it's bound to listens for the
OnDataBindComplete(or something like that...can't recall it right now), and
automatically updates from the proper thread while maintaining responsiveness.
And from a flexibility standpoint, its styling facilities are a radical
departure from WinForms. WPF apps have a logical tree (of buttons, grids,
etc) that have no inherent look to them; they just have functionality (a
button can be pressed, grid can hold stuff, a textbox has a Text property).
But they can look like whatever you want to define their template as. So for
example, if you want to draw a tab control, you could implement it as a radio
button group where each tab is a radiobutton because a tab control logically
functions like a radio button group.


I really wish the WPF cheerleaders would shut up until they have produced a
serious application. Yes we know it does really great things with 3D and
pictures and you can spin stuff around and make a time line animation, but as
far as a serious business application goes, that stuff means nothing. If
Microsoft wants to help give us a DataGrid (not the grid that it comes with)
one that actually holds data. I don't think they have any intention of
building one! Give us a toolbar that easy to use instead of the crap thats in
it. Give us a Menu that you don't have to edit in Xaml. In my opinion WPF
will not be ready for prime time until you able to build an application
without touching xaml. PLEASE DON'T TELL ME HOW MUCH YOU LIKE XAML AND HOW
ITS THE BEST THING SINCE SLICED WHITE BREAD. The truth is the community is
going to be split up into two categories. Developers and Designers.
Developers will be able to handle the xaml and probably create some pretty
ugly apps along the way. But the designers will be people adopted from the
adobe world and are not used to typing anything to create any graphic look.
I'm just telling you the way it is. I hope Microsoft is listening because
you damn sure can't talk to any of them in person.
 
P

Paul Werkowitz

Hello Robert,
I really wish the WPF cheerleaders would shut up until they have produced a
serious application. Yes we know it does really great things with 3D and
pictures and you can spin stuff around and make a time line animation, but as
far as a serious business application goes, that stuff means nothing.

AFAIK, Expression Blend has been written entirely with WPF. It surely is a
"serious business application", although it has some problems in V1.

Please note that you do not *have* to use any XAML at all to program WPF.
XAML is nothing more than a clever scripting system to generate code.
*Everything* (yes, everything) you can do with XAML you can do with C#. The
translation is really easy.

And, yes, I am not a friend of XAML. And I don't use databinding much. But
I like the possibility of having tools that work with XAML, like Blend. I
also like the architecture of WPF, and the new controls. Helped me to make
my software much easier. I don't use the fancy stuff like skins, styles,
templates, video etc.
If
Microsoft wants to help give us a DataGrid (not the grid that it comes with)
one that actually holds data.

Thats missing indeed. But there are some alternatives, even free ones.
I don't think they have any intention of
building one! Give us a toolbar that easy to use instead of the crap thats in
it. Give us a Menu that you don't have to edit in Xaml.

Nobody wants to write menus in XAML manualy, nor in C#. Why don't you use a
tool?

[rest snipped]

Greetz
Paule
 
H

Herfried K. Wagner [MVP]

Paul Werkowitz said:
AFAIK, Expression Blend has been written entirely with WPF. It surely is a
"serious business application", although it has some problems in V1.

The UI has been written in WPF, but the application is written using MFC.
The main window is IIRC an MFC window hosting WPF content.
 
R

Robert

Paul Werkowitz said:
Hello Robert,
I really wish the WPF cheerleaders would shut up until they have produced a
serious application. Yes we know it does really great things with 3D and
pictures and you can spin stuff around and make a time line animation, but as
far as a serious business application goes, that stuff means nothing.

AFAIK, Expression Blend has been written entirely with WPF. It surely is a
"serious business application", although it has some problems in V1.

Please note that you do not *have* to use any XAML at all to program WPF.
XAML is nothing more than a clever scripting system to generate code.
*Everything* (yes, everything) you can do with XAML you can do with C#. The
translation is really easy.

And, yes, I am not a friend of XAML. And I don't use databinding much. But
I like the possibility of having tools that work with XAML, like Blend. I
also like the architecture of WPF, and the new controls. Helped me to make
my software much easier. I don't use the fancy stuff like skins, styles,
templates, video etc.
If
Microsoft wants to help give us a DataGrid (not the grid that it comes with)
one that actually holds data.

Thats missing indeed. But there are some alternatives, even free ones.
I don't think they have any intention of
building one! Give us a toolbar that easy to use instead of the crap thats in
it. Give us a Menu that you don't have to edit in Xaml.

Nobody wants to write menus in XAML manualy, nor in C#. Why don't you use a
tool?

[rest snipped]

Greetz
Paule
 
R

Robert

Paul

What tool? WPF supplies you with a toolbar. But I wasn't able to get it
access any of it properties in vs2008 or in expression Blend. Not until you
created something in xaml first then you could.

Paul Werkowitz said:
Hello Robert,
I really wish the WPF cheerleaders would shut up until they have produced a
serious application. Yes we know it does really great things with 3D and
pictures and you can spin stuff around and make a time line animation, but as
far as a serious business application goes, that stuff means nothing.

AFAIK, Expression Blend has been written entirely with WPF. It surely is a
"serious business application", although it has some problems in V1.

Please note that you do not *have* to use any XAML at all to program WPF.
XAML is nothing more than a clever scripting system to generate code.
*Everything* (yes, everything) you can do with XAML you can do with C#. The
translation is really easy.

And, yes, I am not a friend of XAML. And I don't use databinding much. But
I like the possibility of having tools that work with XAML, like Blend. I
also like the architecture of WPF, and the new controls. Helped me to make
my software much easier. I don't use the fancy stuff like skins, styles,
templates, video etc.
If
Microsoft wants to help give us a DataGrid (not the grid that it comes with)
one that actually holds data.

Thats missing indeed. But there are some alternatives, even free ones.
I don't think they have any intention of
building one! Give us a toolbar that easy to use instead of the crap thats in
it. Give us a Menu that you don't have to edit in Xaml.

Nobody wants to write menus in XAML manualy, nor in C#. Why don't you use a
tool?

[rest snipped]

Greetz
Paule
 
P

Paul Werkowitz

Am Wed, 23 Jan 2008 05:31:03 -0800 schrieb Robert:
Paul

What tool? WPF supplies you with a toolbar. But I wasn't able to get it
access any of it properties in vs2008 or in expression Blend. Not until you
created something in xaml first then you could.
Drag some stuff from the VS2008 toolbox into some XAML. Then look at the
XAML, and you sure will be able to do the same thing with pure CX, VB or
IL.

After you understand the whole thing, you even can replace the whole XAML
with C#, VB, IL or whatever.

Paule
 
R

Robert

Paul

I'm using vs 2008 for c#, this copy can't drag anything into the xml code?
You can drag it into the Window. But that doesn't help. You still have to
know xaml to do anything with it.

Rob
 
R

RobinS

Robert said:
I really wish the WPF cheerleaders would shut up until they have produced
a
serious application. Yes we know it does really great things with 3D and
pictures and you can spin stuff around and make a time line animation, but
as
far as a serious business application goes, that stuff means nothing. If
Microsoft wants to help give us a DataGrid (not the grid that it comes
with)
one that actually holds data. I don't think they have any intention of
building one! Give us a toolbar that easy to use instead of the crap thats
in
it. Give us a Menu that you don't have to edit in Xaml. In my opinion
WPF
will not be ready for prime time until you able to build an application
without touching xaml. PLEASE DON'T TELL ME HOW MUCH YOU LIKE XAML AND
HOW
ITS THE BEST THING SINCE SLICED WHITE BREAD. The truth is the community
is
going to be split up into two categories. Developers and Designers.
Developers will be able to handle the xaml and probably create some pretty
ugly apps along the way. But the designers will be people adopted from
the
adobe world and are not used to typing anything to create any graphic
look.
I'm just telling you the way it is. I hope Microsoft is listening because
you damn sure can't talk to any of them in person.

I saw a demo of an application at MacWorld called Jing. The Windows version
is written in WPF with a WCF backend. The application is very attractive. It
lets you take screenshots and send them up to a server (or save as a file,
or ftp) or record video and send or save.

It is written by TechSmith (the people who wrote Camtasia and Snagit), and
it's called Jing. Check it out: http://www.jingproject.com
I thought it was pretty impressive. It's not a heavyweight application in
terms of business, but I thought the design was very well done.

RobinS.
GoldMail, Inc.
 
R

Robert

Robin

Yes that is pretty cool. But it's not a desktop application which is what
thte orginal question was that started this thread. Yes you can do some
pretty cool things with WPF right now, but all the examples I've seen there
all graphical. Right now I think that is where the strengths are in WPF.
Developers should probably design in winforms and use WPF in them where
needed. If they do that it won't be such a hard transition when there is
enough tools to do a proper business application.

Robert
 
R

RobinS

I agree. Data binding isn't what it is in WinForms, and there's nothing
equal to the DataGridView, which while it can be a pain in the a**, is very
flexible.

RobinS.
 
L

Lars Siden

I've really tried to be positive to WPF. Sure I can see good things:

1. The dynamic way to "create controls out of controls"
2. The power of having the GIU in XAML
3. More control over the gfx interface

BUT - and this is a big but!

The tools VS2008 / Expression etc is VERY BAD! VS2008 gives poor
intellisense when working in XAML and the lack of a visual designer that
really works(like the one for Winforms) is embarrasing. The MSDN help is
also very poorly written for WPF, few examples(and many of the samples won't
work for the RTM of WPF) - the help text on the classes is many times just
one line.

WPF is good when dealing with media rich applications, dealing with few
controls - but for us working with more business type of apps it doesn't cut
it! And it won't be able to replace winforms until there is a decent set of
tools to work with. IMHO, Visual Studio should be all a professional
developer should need, all tools for generating the code and GUI should be
there. Then there could be other tools that handles ONLY GUI.

// Lars Siden

Robert said:
Paul Werkowitz said:
Hello Robert,
I really wish the WPF cheerleaders would shut up until they have
produced a
serious application. Yes we know it does really great things with 3D
and
pictures and you can spin stuff around and make a time line animation,
but as
far as a serious business application goes, that stuff means nothing.

AFAIK, Expression Blend has been written entirely with WPF. It surely is
a
"serious business application", although it has some problems in V1.

Please note that you do not *have* to use any XAML at all to program WPF.
XAML is nothing more than a clever scripting system to generate code.
*Everything* (yes, everything) you can do with XAML you can do with C#.
The
translation is really easy.

And, yes, I am not a friend of XAML. And I don't use databinding much.
But
I like the possibility of having tools that work with XAML, like Blend. I
also like the architecture of WPF, and the new controls. Helped me to
make
my software much easier. I don't use the fancy stuff like skins, styles,
templates, video etc.
If
Microsoft wants to help give us a DataGrid (not the grid that it comes
with)
one that actually holds data.

Thats missing indeed. But there are some alternatives, even free ones.
I don't think they have any intention of
building one! Give us a toolbar that easy to use instead of the crap
thats in
it. Give us a Menu that you don't have to edit in Xaml.

Nobody wants to write menus in XAML manualy, nor in C#. Why don't you use
a
tool?

[rest snipped]

Greetz
Paule
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top