WinForms vs WPF

If you have followed me at all over the years, on version 1, 2 or 3 of this site, you know I prefer WinForms over WPF.

A quick run down between the two. WinForms is the older Windows desktop application technology. After seeing some of the issues with WinForms, WPF was dreamed up about 5 years later as its replacement. WPF, allows better workflows for teams, scales easier and has a bunch of really great features about it. It uses an XML variant called XAML to create the controls. WPF is vector based so it scales really pretty. It really is not a bad technology. However, with all those features came a couple of big drawbacks.

I know I shock .NET developers all the time with my preference. Apparently, it is not the norm. I met a guy whose WPF application I took over development on several years ago. Rather than dismiss me as the nut I may be, like most .NET developers would if you say that to them, he asked why.

Why?

There are two big reasons to consider using the WinForms over WPF. First is WinForms is faster. Second is that WinForms is faster. Let me explain more.

Because it is a straight forward setup, getting a WinForms application is faster to develop than a WPF application. Dealing with the XAML is just not as easy and fast.

Next on the list of reasons, is I have never seen a WPF application out perform a WinForms application. Every WPF application just feels slow to me. As a result of all that flexibility and power they gave to the technology, I think it made it slower.

Before you inundate me with all the articles that say otherwise, I understand that is not suppose to be the case. In my chunk of the world, WinForms is the faster application. That might be an interesting subject for a head to head test post. Maybe I will do that. Make a WPF version of my Noob to Pro series then run them side by side. Maybe I will convert myself.

My “Why” on the WinForms, WPF debate is really domain specific to me

In my little world of everyone wanting everything super fast and super cheap, spending 3 multiples configuring on the WPF GUI just does not fly. They are small apps for small firms. If I spend more than an hour on GUI work, it is considered a waste of time and I am milking the clock. It is really awful since I have yet to be happy with a GUI design since I started down this independent path.

Besides, as I pointed out to the guy who said why. If WPF was so the right now, why has Microsoft not made an update to it in three years? At the time, they had not yet made WPF open source and development had stopped.

So with what I feel are the advantages of WinForms out of the way, when would I use WPF.

WPF

I like WinForms for smaller applications. For that domain, 9 times out of 10 it is superior. Now where does WPF fit into my world view. WPF is where you put bigger and/or more GUI complex desktop apps.

If I was working with a designer then I would completely be behind using WPF so I could take advantage of their skills. Even without a designer, if the application requires out of the box controls for the GUI, WPF is better.

With all that there is more, WPF is far easier to create controls in than WinForms. I knew a guy who talked about building WPF controls and importing them into WinForms. It’s crazy. For doing weird and wonderful stuff, WPF is the way to go.

If Microsoft ever figures out Xamarin, the the XAML based GUI makes WPF even more attractive.

If I was recommending to a new .NET developer, which to learn. I would say WPF. Honestly, you can do everything in WPF that you can do in WinForms but that is not really true the other way around.

Wrapping up the WinForms vs WPF debate

Finally, the reality is that both .NET and desktop apps are dying off. Microsoft is not putting anymore effort into either one of them. As a result, if you are new to .NET then I would tell you to learn MVC.NET. Learn one of the JavaScript GUI libraries and don’t worry too much about it.

The future is bleak enough, I have been giving serious consideration to abandoning desktop apps for development all together. I need to really learn MVC.NET inside and out. I have a functional understanding of it but not a dominant understanding.

Then we have the whole .NET Core issue to worry about and how it will develop over the next couple of years. In the end, it really would not surprise me if the cross platform GUI issues .NET Core gets resolved by using browser technology and JavaScript libraries and using it on a internal web server for a “Desktop App”.

1 Comment

Leave a Reply

Your email address will not be published.