13

There is a similar question at WPF versus Windows Forms which has some good information but in my personal experience I see no reason to use WPF over Winforms. With WPF initially there was lots of talk about it's multi-threaded functionality but in use I see no benefits.

I have two applications that do the same thing, one in WPF and on in Winforms. The Winforms application blows the WPF application away in terms of performance (by a factor of 10) and looks just as nice.

Granted I am more proficient in Winforms applications than WPF.

Community
  • 1
  • 1
Cory Charlton
  • 8,868
  • 4
  • 48
  • 68
  • WPF > WinForms because you can put a web browser in a button! ;) – Rich Schuler Dec 18 '09 at 02:57
  • @Qberticus: Not sure I follow your response. I can easily create a WebBrowserControl and handle the `Click` event. – Cory Charlton Dec 18 '09 at 02:59
  • What QBerticus means is that the WebBrowserControl would be *inside* the Button control, both visually and logically (can't say why anyone would want that) – R. Martinho Fernandes Dec 18 '09 at 03:02
  • 2
    You wouldn't, but the fact that level of compositing is possible, along with the data binding features, and the animation ability, just makes WPF fun to work with. – Rich Schuler Dec 18 '09 at 03:10
  • 3
    Multi-threaded? I never saw WPF being sold on its multi-threaded functionality. I saw it being sold on fancy graphics and animation, I saw it being sold on scalable vector drawing, I saw it being sold on architecture and productivity... but multi-threading? I missed that... – itowlson Dec 18 '09 at 03:20
  • 1
    The multi-threaded talk is in reference to the fact that the visual-tree rendering pass happens on a separate thread. And yes, this is one of the big perf things in WPF that enables all the smooth fancy graphics that can't be done in WinForms. – Franci Penov Dec 18 '09 at 03:47
  • @Cory - if you want to see something that can't be done in WinForms - http://chriscavanagh.wordpress.com/2009/08/25/a-real-wpf-webbrowser/ (and the rest of the samples on the same blog) – Franci Penov Dec 18 '09 at 03:48
  • @itwolson: Life Franci said, and the whole CheckAccess() ... Dispatcher idea (which smells a lot like `InvokeRequired` ... `Invoke` to me. – Cory Charlton Dec 18 '09 at 04:11
  • @itowlson I agree. When I think of WPF, I think of beauty. If you're going for a internal design (workplace), most likely Windows Forms is the best option as there is much less over head, and eye candy is not as much of a factor in the work place. If you're developing an external design (customer facing) where you would like to include UI candy, animations, 3D, etc. Then WPF comes in handy. – clamchoda Mar 09 '12 at 21:39

5 Answers5

16

There is another discussion on the subject here: When is Windows Forms the correct choice vs WPF?

The Winforms application blows the WPF application away in terms of performance (by a factor of 10) and looks just as nice.

WPF is about more than just fancy graphics... I'm not a designer, hell I have no feeling for colors (to a point where my fiancee decided I can no longer buy my own clothes) but I love WPF. DataBinding support for example is amazing not to mention how easy it is to create a ItemTemplate for a ListBox (remember overriding the draw methods in Windows Forms just to get 2 lines of text and an image in a ListBox item?)

As for performance... in my experience the improvement can only be noticed if you're using Windows Vista / 7 with a GPU. (And of course the way you write code).

Perhaps it was a mistake by Microsoft to market that WPF is all about pink elephant graphics while it does so much more. (They made a similar mistake with the rushed release of Silverlight 1, which in my opinion they should have skipped all together).

Community
  • 1
  • 1
TimothyP
  • 21,178
  • 26
  • 94
  • 142
  • 5
    +1 Definitely, WPF's major benefits are the great flexibility you get and how you can write much better code, like the Model-View-ViewModel pattern. – R. Martinho Fernandes Dec 18 '09 at 03:05
  • 3
    Agree with Timothy and Martinho, it's about the architecture. Templating and data binding are compelling reasons to use WPF: you can get so much more done, so much more easily and so much more maintainably. And definitely agreed that Microsoft's marketing of WPF as a way to create silly button designs was a mistake. It's *all* about the architecture. – itowlson Dec 18 '09 at 03:16
4

WPF

  1. allows a designer/non-programmer to improve the appearance of the UI, separate from the code. Designers can use tools like Expression Blend to heavily modify the look of an app.
  2. the knowledge required for writing WPF is almost entirely transportable for writing Silverlight code, so you are climbing one learning curve for two technologies
  3. is heavily and actively promoted by Microsoft, and has probably more future than WinForms. WinForms will go the way of MFC before WPF does.

on the other hand:

  1. the learning curve is heavier for WPF than Winforms
  2. designer support is lacking compared to Winforms, although this may change with Visual Studio 2010
  3. the current trend is to use View-ViewModel-Model to build applications: this is further learning on top of the WPF framework, but is worth the effort if you are going to build anything beyond simple UI's

If performance (speed and resource requirements) is your criteria for a good UI platform for Windows, then the winner is a native Win32 application. You adopt another technology for what they have to offer, and ultimately WPF has more to offer than WinForms.

Phillip Ngan
  • 15,482
  • 8
  • 63
  • 79
2

Biggest issue with WPF is that the toolset is lame and learning curve is huge. So far uptake on WPF has been very low mostly because of the issues I just mentioned. According to Microsoft WPF is the future and they have invested heavily in it. Infact next version of Visual Studio is written in WPF (http://www.onedotnetway.com/writing-visual-studio-2010-shell-in-wpf-reflects-confidence/)

However it still remains to be seen if WPF will ever become mainstream. The framework is awesome and it can do really cool stuff mostly related to eye-candy. Microsoft calls it UX but in plain English it is eye-candy. Most of the applications don't need it.

Ronald
  • 31
  • 1
  • 3
    Anyone claiming the cool stuff you can do in WPF is *mostly* related to eye-candy is either 1) someone that has *played* with WPF, but didn't *learn* WPF, 2) a user. – R. Martinho Fernandes Dec 18 '09 at 03:23
2

The biggest reason to go with WPF isn't eye-candy. The real gains are in terms of reliability, productivity, and allowing the artistic types to modify the appearance of your UI without involving engineers.

kyoryu
  • 12,848
  • 2
  • 29
  • 33
0

WinForms and WPF are both great frameworks the question is what is best suited to your application. If you need a fluid gui with animated controls and very themable styles, or are just creating a very graphical user interface WPF is very good for that kind of application. WinForms can be very limiting at times because the controls are what they are you can create user controls to add things to them but changing their appearance can be difficult if you have a very specific look in mind.

A good comparison would be looking at the difference between a WinForms application and a silverlight application. Silverlight and WPF share a common framework and it will help you to understand the differences between the two.

Have a look at this silverlight and wpf library and you will see some of the things that can be done in a wpf environment.

Silverlight Library: http://demos.telerik.com/silverlight/

WPF Library: http://demos.telerik.com/wpf/

scptre
  • 334
  • 1
  • 9