When creating a new GUI, is WPF the preferred choice over Windows Forms? [closed]

After three months of trying to hammer out a line-of-business (LOB) application on WPF, I reached a point of considering turning back to Windows Forms for my project, and in researching other people’s opinions, came across this thread…

Yes, WPF is a brilliant technology and it has benefits that span far beyond mere eye-candy… the templating and binding capabilities are great examples. The whole object model offers more flexibility and broader possibilities. That doesn’t, however, make it the defacto platform for future LOB applications.

The “problems” which WPF solves in terms of separating GUI from business logic aren’t problems which can’t be readily solved in Windows Forms by simply starting with the right architecture and mind-set. Even the object-path binding capabilities of WPF can be reproduced in Windows Forms with some very simple helper classes. The data template capabilities of WPF are very nice, but again they’re nothing that you can’t simulate in Windows Forms on those rare occasions when you absolutely don’t know exactly what objects you’re going to represent on any given part of the screen.

Where Windows Forms races ahead is in terms of maturity. You can’t swing a dead cat on Google without hitting some blog where someone has solved a Windows Forms problem for you. WPF, on the other hand, has comparatively less learning resources available, fewer custom controls available, and hasn’t had as many of its teething problems solved.

At the peak of making a WPF vs Windows Forms decision has got to be the maturity of the development environment. Windows Forms editors are slick, responsive and intuitive. Feedback about errors gets to you instantly, the solutions are usually obvious, and the compile->debug->edit cycle in Windows Forms is very quick.

WPF applications, on the other hand, have comparatively pathetic design time support, with the design view all-too ready to chicken out at the first encounter of an error, often requiring a project build after the fix before the designer is willing to kick in again. Drag’n’drop of components from the toolbox might as well not be supported, given the vast range of circumstances under which it either doesn’t work at all, or yields completely unintuitive results. Despite the promise of the WpfToolkit, there still isn’t a usable DataGrid for WPF that yields any kind of resonable performance or design time friendliness.

Debugging WPF applications is a bit like the old ASP.NET debugging paradigm… hit F5 -> wait -> launch -> error -> stop -> fix -> hit F5 -> wait -> launch -> error -> groan -> stop -> fix -> hit F5…. All XAML which your program is running is locked, and tracking down XAML specific problems is often tedious.

The bottom line, simply put, is that the development tools for Windows Forms are going to have you banging out front-ends in a fraction of the time of a WPF application… especially if you’re creating master-detail grids or spreadsheet like interfaces, which most LOB have. With Windows Forms, you start with 90% of the work already done for you.

I’m a huge fan of the WPF architecture. I just wish the design-time tool-set didn’t feel like a pre-alpha debug-build.


Edit: This answer was posted about .NET 3.5 + Visual Studio 2008, but .NET 4.0 with Visual Studio 2010 ships with a WPF data grid. While many improvements have been made to the new WPF development experience, my answer here remains unchanged, and I’d like to add the following suggestion:

If you’re in a rush to do RAD development, go with Windows Forms. If you’re looking to produce a well architected, maintainable, scalable, resource firendly, multi-user Line-Of-Business application, consider ASP.NET MVC + HTML 5 + jQuery… My projects with these technologies have resulted in better outcomes, sooner, for my customers. MVC offers all of the same templating that WPF does, and jQuery enables animations and complex interactions. More importantly, an ASP.NET MVC + jQuery solution doesn’t require your end users to have modern desktops with decent graphics hardware.

Leave a Comment