Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use WPF over Winforms? Any examples of WPF outperforming Winforms?

Tags:

.net

winforms

wpf

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.

like image 880
Cory Charlton Avatar asked Dec 18 '09 02:12

Cory Charlton


People also ask

Why we use WPF instead of Windows Forms?

WPF allows developers to create event-driven rich client applications for usage on the Windows operating system. WPF can be used to develop and design both Windows applications and web applications while WinForms can only be used to develop and design Windows applications.

Why should I use WPF?

It is compact compared to the many lines of code to declare the same text box within Windows Forms. It lends itself better to code generation. It allows for better portability from desktop to Web as this same code could be interpreted differently based on whether it is running within WPF or Silverlight.

Why is WPF faster than WinForms?

This is due to the fact that the WPF framework is much larger than winforms and therefore it has many more "things to load" in order to work. This is also true when you compare the cold startup times (again, in a 1-control situation).


1 Answers

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).

like image 96
TimothyP Avatar answered Oct 20 '22 13:10

TimothyP