WPF vs Windows Forms


I see Josh Smiths has posted his view on WPF vs Windows Forms.  Here’s my current view (although I reserve the right to change it at a later date 🙂 )

Windows Forms is legacy.  Microsoft should label Windows Forms as legacy (as it has done with COM), only offer bug fixes and concentrate 100% on WPF.  WPF is the future.  I’ve had more fun building WPF UI than I’ve ever had with Windows Forms.  Ignoring the WPF fun element, I think the WPF applications I’ve build are far superior to anything I did in Windows Forms from the perspective of usability and visualization of data.  Here are a few advantages to using WPF:

  1. Databinding in WPF is superior to what Windows Forms offers.
  2. UI  and C# business logic can be cleanly separated in WPF
  3. Storyboard 🙂
  4. Data/control templates – a much cleaner way than anything Windows Forms can offer.
  5. Styles – cool and simple.  Its so easy to style all your buttons in an application to have the same look and feel.
  6. Even if the VS designer breaks, its easy to code XAML.
  7. UI virtualization – I’ve got grids with 100K rows, ticking off a moving market.  Performance would be dreadful if it wasn’t for UI visualization which come for free.
  8. 3D support.
  9. Nothing scientific but, UI development feels quicker in WPF – maybe its just because a WPF application looks cooler at the end of an iteration, or maybe its because development really is quicker.
  10. I can add a User Experience engineer to my team, and with no C# knowledge he can work magic in Expression Blend and give the front-office trading application a makeover that is guaranteed to win over the business users.

~ by mdavey on September 5, 2007.

38 Responses to “WPF vs Windows Forms”

  1. Interesting. I *want* to agree with you wholeheartedly, and initially was of the same opinion as you. However, in my opinion, the reality of the situation is that WinForms is far from dead…yet. Its murderer, so to speak, does not even have a non-beta set of tools to work with in Visual Studio. Big Daddy WinForms can’t be killed by an infant with no weapons! 🙂

    I think in about a year or two WinForms will be “legacy,” whether MSFT deems it so or not.

    Thanks,
    Josh Smith

  2. Hence why I said “concentrate 100% on WPF” and effectively drop Windows Forms 🙂 Windows Forms has served the world well, but its essentially just a Win32 wrapper. Microsoft should have had VS enabled for WPF out of the gate – ok cider existed as an addon, but was never supported. Software engineers shouldn’t have had to wait till VS 2008 for true WPF support. I suspect every tier one investment bank has effectively held off from pushing WPF development apart from adhoc projects because VS 2008 hasn’t arrived.

  3. […] Matt Davey posts 10 advantages to using WPF and links to Josh Smiths’ post who answers the question “WPF vs. Windows Forms”. […]

  4. Ah, so you mean that WinForms is “dead” in the sense that WPF is destined to kill it. I see. That must make all the experienced WinForms folks feel warm and fuzzy! 🙂

    I have no great hopes for the WPF tools in VS2008. I’m really looking forward to the Rosario era, at which point Microsoft should have had plenty of time to work out all the kinks discovered in VS2008.

    Thanks,
    Josh Smith

  5. BTW – in point (7) I think it should mention “UI virtualization” not “visualization.”

  6. I agree with the advantages you have listed for WPF, but I don’t think winforms is dead by far…atleast not for the masses.

    I think the high-end dev’s will see that WPF can and will make their jobs easier, and give them more power to produce results. But I also think there are allot of dev’s who are scared of XAML, they either don’t understand it or are intimidated. That will keep winforms alive, just as VB6 is still around so will winforms for a long time.

    Personally I think the databinding features in WPF are worth the move alone, it cuts down on the amount of tedious code I have to write.

  7. TJ,

    I agree with everything you wrote. I’d like to add that “simple” things like routed events, attached properties, and triggers are also parts of WPF which make it a developer’s paradise compared to WinForms.

    Thanks,
    Josh Smith

  8. Honestly I think I want to have what you are all smoking. 🙂 You’re all making the classic mistake of taking your own area of work and expertise and trying to extrapolate it to every other field of work and expertise.

    How is databinding superior? It works fine in winforms, different isn’t necessarily superior. Most of us that do serious databinding have already got our own libraries of helper code that pretty much takes all the tediousness out of the process anyway.

    UI and business logic separation is up to the developer, it’s nothing new, some of us have been doing it since the MFC / c++ days. Don’t piss on my leg and try to tell me it’s raining. 🙂

    Styles? WTF? How is this new, sure it’s easier to change them, perhaps 10 minutes as opposed to half an hour, so what? That’s not really a death knell for winforms.

    If VS breaks I fix it, you can’t work with broken tools, who wants to code in XAML? I could as easily say if VS breaks I can hand code assembly in wordpad.

    UI Virtualization, sure that’s cool, is it the death of winforms?

    We already have the tools to makeover winform apps with no muss or fuss, I can do that now with my 3rd party winform control suites, that’s not compelling.

    If you want to convince the non believers you really need to come up with something more compelling than “it’s cooler”. All I’m getting from WPF camp is a fuzzy Mac vs PC type argument.

    Sure it’s fun to work on the cutting edge but don’t get all misty eyed and forget that you’re about 5 years ahead of the curve out there. We’re still supporting customers using windows 2000 with our winforms apps.

  9. Databinding in WPF is not superior, its just better. IMHO winforms databinding compared to WPF cannot be called databinding. Yes you wrote your own library, but wait, do we have to wrote our own libraries?

    If VS breaks you fix it. In my case VS dont break because i use it for coding and for UI design I have Expression Blend, a powerfull tool destined to be UI designer.

    WinForms is death, sooner or later, its inevitable.

  10. I agree with Peter. It doesn’t sound like JCardinal is too familiar with WPF, which makes it easy to blow it off. Once you get into WPF and understand what it offers, it’s hard to imagine going back to WinForms. 🙂

    Josh Smith

  11. The major con for WPF, as I see it, is the stupid Windows XP or later requirement. This will set adoption back years.
    Windows 2000 is still widely used, and for good reason. It’s essentially the same OS as Windows XP, so there’s no reason for most users to upgrade.

  12. Hi Josh, actually I’m quite familiar with wpf, I’ve studied it, have *the* book for it, wrote a few apps etc etc. My issue is that I have released applications written with winforms, recently ported from mfc and running on many end users systems that are windows 2000.

    I agree that wpf is cool and I find the whole underlying windowing system to be a great idea, aside from that I don’t see a lot that could not be ported to winforms.

    It’s nice for Microsoft to have so many unpaid cheerleaders for their new technology, but I don’t think you guys realize how far ahead of the curve the great majority of us are working on. One guys comment here about “advanced developers” working on wpf as if the rest of us are idiots for not working with wpf shows this attitude is not grounded in reality.

    Think and post what you will, but to say that winforms is dead over and over sounds like you guys are just whistling in the dark to me.

    I agree that much of wpf is superior, I just don’t see any realistic way for it to take over from winforms for any kind of time frame you guys keep bandying about.

  13. JCardinal,

    Gimme a ‘W’!
    Gimme a ‘P’!
    Gimme a ‘F’!

    What does that spell?! “Alpha geeks who are bored with WinForms and found a new platform which excites them, so they blog about it and discuss with each other how much they look forward to it becoming mainstream!” 🙂

    Josh Smith

  14. Well to be honest it excited me as well when I first saw it, the xbap stuff is very dissapointing but wpf itself is undoubtedly cool, but I don’t see the death of winforms any time soon. I’m going to take a wild guess and say that if Microsoft is indeed moving to wpf and dropping new winform development a realistic time frame for seeing widespread wpf adoption would be somewhere around 2011 at the earliest.

  15. Yeah XBAP isn’t all that cool, imo. I actually just wrote a big harangue on that: http://joshsmithonwpf.wordpress.com/2007/09/05/wpf-vs-windows-forms/#comment-4853

    2011, eh? That seems a bit too far off to me, but only time will tell. Hopefully you’re way off on that estimate! 🙂

    Josh Smith

  16. […] WPF vs Windows Forms I see Josh Smiths has posted his view on WPF vs Windows Forms. Here’s my current view (although I reserve the […] […]

  17. The tntire .NET bandwagon is dead for me and we ported to WPF in beta and have it sitting around for kids to play.

    Do you really run that stuff on a live trading desk?

    Heck even WinForms?

    Cool, because we are fighting for money with our own native frameworks without any dumb, generic-for-all, leak to death data binding and WinForm CPU exhaustion.

    Classic Java following that will crash in Swing style spectacularity. Never stops this enthusiasm for MSFT marketing.

  18. Three words. Horrible Font Rendering! WPF font rendering is so stinkin blury (at least on XP SP2) that there is no way I can develop apps in it – it just strains the eyes too much. And, as far as I can tell, there is no way to turn off the horrible anti-aliasing, and WPF ignores windows settings. Showstopper for me, otherwise I might like it.

  19. WPF = Geek Crack.
    Winfoms = Old Dog.

    Interestingly,

    Vista = Geek Crack.
    XP = Old Dog.

    If the XP to Vista conversion rate is any indicator of WPF adoption, I’d say 2011 is an optimistic time frame for WPF apps to go live beyond a small number of early adopters that service clients with the specs to run WFP apps.

    The good in my opinion is that windows programming needs a facelift to be competitive with say things like Adobe Air. WPF is a good first stab, and as it matures it will be a killer tool to use, but it needs a little time on the vine (re: “you can just write XAML if VS breaks”) to work out the kinks.

  20. .NET was a killer for earlier Microsoft programming frameworks such as VB6 and MFC. It was a huge jump but still there are plenty people who are using pre .NET technologies. I started using .NET with 1.1 and now i am on 3.5. WinForms has been a great platform to work with throughout. The bad thing is you can never be an expert because as soon as you grasp some technology, its already legacy. I use to laugh at people who said that when i was starting .NET. Now i can realize that myself as i have hold on .NET and within 6 7 years of their conception, WinForms are already legacy.
    New technology, methodology, platforms are always exciting and mostly good but depends on applications and real world parameters. I dont think i would leave XP for Vista in next 5 6 years. So i wont leave winforms either. It depends on a developer how to get work done as people have developed 3D games in C language.

  21. […] is a lot more to WPF than meets the eye, so to speak. WPF vs Windows Forms Tales from a Trading Desk __________________ There are 10 types of people in this world…. those who know binary, and […]

  22. WPF may be cool for “for fun” developers. I would not mind trying it out. But I life in “real life”. In a company with a limited number of programmers and a lot of work and deadlines for projects and many complex, big applications you can’t just throw in a new technology and expect everybody to learn it and apply it, let alone change all the apps to wpf. And why should they, if good old winforms suit the purpose? If you’ve got a lot of time left (in having time left is a rather scary thought in your job) then you can spend time on wpf. In most applications that do not work with graphic development the end user won’t see the dif between winforms and wpf and therefore won’t mind which one is used. As long as that’s the way it is wpf is a toy for hobby programmers who are eager to test new technologies.

  23. If they can solve the bufferedgraphicscontext exception bug, titlebar flicker on form construction bug, and the transparent background issues, it’s worth it to change over. Note: These are not features

    I think that winforms is a monster that should be either put down or donated to a mad scientist for research/pleasure purposes.

    It’s clear when you look at the lower level classes of .NET that winforms GUI was just a low level C++ or VB(eww) implementation that was hacked into a hybrid managed/unmanaged code format.

    I would like a GUI environment that doesn’t make me want to crawl up in a fetal position and suck my thumb. I thought the benefit of having managed code was that now all exceptions can be caught and traced/diagnosed easily.

    I swear, I go back to doing webdev coding sometimes just so I can remember what it’s like to work on a GUI with some sense of security. My job is to write apps, not track bugs for MS that they’re not even willing to fix.

    I’m looking forward to picking up WPF. I expect it to be a very easy transition from a webdev backgroung (where I started), and the XML style of source code opens up tons of opportunities for mobility and interoperability with/through the cloud.

    I know the guys who write assembler for fun and masturbate to Intel® 64 and IA-32 Architectures Software Developer’s Manuals will all be up in arms, but WPF could be (fingers-crossed) a step in the right direction.

    I absolutely loved how easy it is to work in C# .NET when I started coding desktop apps, until, I had to start using winforms for serious application development. Nothing like taking a well oiled machine and filling the tank with sand ::sigh::. Note: I didn’t come from a C++ MFC background so I have no appreciation for walking to school 2 miles uphill through the snow both ways.

  24. First, forgive me for my lausy english.
    You all are crazy if you realy think that WinForms will be dead soon. I would love to know that WPF will kill Winforms but, in my opinion, the WPF will die long time before the end of WinForms.
    I’me investigating the possibility to use WPF in my entreprise nextgen applications. So far, the conclusion is that WPF was great if we need software that looks like pink japanese watches for teenage girls when we need is rock solid,fast and reliable Apps.
    Regarding to the separation between UI and Code… a lot of umbilical chords remains there that should’n be. In my company’s current software version (MFC) that separation is real and the dependency is reduced to minimum. We are studing the need to migrate all that mechanism to new version since no technology ón the marked is good enought, not eaven WPF.

  25. I agree with joth rido, although wpf is fun to program with but still winform is a lot easy and scalable plus winform has many 3rd party controls and lots of help available for line of business applications.

  26. These numbers seem too small but I double checked. ,

  27. Predict the future is a hard thing.
    I know that this issue is not important for all of you but could be necessary to say that VFP (VFP not WPF) is a Ghost Alive and Well. MS Condemned VFP To Death a lot of years ago. It a shameful thing but we have to understand that VFP is alive.

    A now the queston: If VFP is alive after more that 10 year of its official death. How many year will be alive Win Forms?
    Ten? Twenty?

    We may follow a way if we feel that this way is better not if this way is going to kill the other ways.

  28. I think WPF is awesome but it lacks one very important thing: Strict design guidelines by Microsoft. WPF’s incredible flexibility is also its weakness, because you can do ANYTHING with it. So as WPF is adopted by more and more apps out there, windows users will become more and more confused, because every app looks completely different and is different to use. Right now in WinForms, most apps at least stick to the basics like MenuBar, StatusBar, MDI interface etc, and they all look alike. I’ve studied the behavior of “stupid users” for many years, and so far I must say that only Apple has understood how to make apps easy to use. All apps on the Mac use exactly the same UI principle. So WPF could be fatal for Windows’ reputation, as it will make Windows look like a giant patchwork of bells and whistles nobody needs. I wanted to start one of my new apps in WPF, but the learning curve is so incredibly steep that I had to stop due to lack of time and lack of design guidelines. I know it sounds craty, but WPF leaves TOO MUCH freedom to developers.

  29. There is obviously a lot to know about this. There are some good points here.

    I’m Out! 🙂

  30. The Windows Forms or WPF decision should be based on the job at hand. You have heard the saying of driving a 10 wheel dumptruck to the super market. Use your common sense here. If you need to incorporate rich windows with video, audio, stock ticker streaming etc., go with WPF. Just remember, the WPF framework has over 3,000 classes. The learning curve will cost you time and money.

    For most commercial jobs WF is just fine. The idea that WF will be legacy is akin to making believe COBOL is extinct. Windows Forms is still the right call on many application development projects now and in the future. Just because WPF is nerdy cool does not mean anything to IT managers that have a budget and resources to contend with.

  31. Well, I took over a WPF project that was thought as a kind of experiment. I needed some GUI editor (purpose unimportant) and thought (as an experienced C++/MFC programmer) that it might take 2-3 months of work using the old way. Our .Net guys convinced the chief that using the new tools (WPF) the development will take 2-3 weeks.

    Well, after 1.5 month I got unfinished project full of bloody abstractions that just obscure the subject.

    Of course, now I am seriously studying WPF, too. And I often find myself wondering, what it can always do. (Fantastic, without any irony.) But when I try to do some particular thing, I often find that it would be done faster and with much less code in MFC. Damn, I don’t need fancy things that can be done in WPF.

    Without delving into unnecessary details, I can say general thing – the old programmer used a canoon to kill a fly. The result is a code that is readable by a single person and even this is probably valid for a limited time only. (Not my opinion only.)

    Well, you may say that awkward things can be done in any programming environment, but I think that they are done the easier the more advanced and more liberal the environment is.

    Our graphic designer was not too happy with Blend either, but that’s another story.

    Sorry, I had to venture my negative thoughts. Maybe it will become better in the future. But I am not overly optimistic at the moment.

  32. Hi, I’ve been doing Win Forms and ASP.NET for the past decade or so. Although WPF is incredibly flexible, there’s a pretty steep learning curve and the tools are in their infancy. The WPF designer in Visual Studio is pretty much useless, and you’re forced to code your UIs almost entirely by hand. Not to mention that VS crashes several times a day when doing WPF and there are screen refresh issues. I’m hoping that VS2010 fixes some of these issues, but I feel like I’m back using the VS2002 beta when I’m doing WPF.

  33. WPF has more features than Forms, but it comes at a cost when considering the overhead in CPU activity, memory and start up time. See:
    http://www.codeproject.com/KB/dotnet/RuntimePerformance.aspx

  34. […] WPF vs Windows Forms September 200733 comments 4 […]

  35. Hi, I reached this blog lookin only one thing, how can I use MDI (multiple document interface) on WPF, but aparently Microsoft has forsaken MDI on WPF, and I can tell you guys that is one (of their many) Achilles’s heel, because there’s no support for it, only third party assamblies, whom by the way won’t work like is spected, and the main reason is that all the windows are contained in the same class… so, I have a lot of questions like this: what happen with a CRM that use 10 or 20 diferent windows? how do you debug that?, how can you give maintenance to that horrible monster?, and the most paralyzing question for you, your enterprise can afford to pay the high cost of that third party assamblies?.

    believe me, I was very impressed at first with WPF (and his bastard brother silverlight) but on the real enterprise enviroment are still lacking of several things

    Currently I have been trying to mix the MDI capacity of Windows Forms with WPF, but has a lot of bugs that make impossible to use it at this time.

    on conclusion, WF are here to stay, until WPF can became his true successor, inheriting the best things of WF.

    Greetings to all from Mexico

  36. Hi! This is my first visit to your blog! We are a collection
    of volunteers and starting a new initiative in a community in the same niche.
    Your blog provided us beneficial information to work on.
    You have done a outstanding job!

  37. WPF is better! There are 10 reasons why at http://www.wiseowl.co.uk/blog/s308/wpf-winforms.htm.

  38. Yeah it’s so superior that WinForms is stills supported in NET4.5 and VS2013.
    I made an app under WPF, my customers where happy at the beginning…
    It took more than 30sec to start it, and it’s used maybe one time a day. The same application using WinForms load in less than 5sec…so we repackaged it with WinForms, my customer are really happy with perf while they don’t bother with cool graphics.

    Personnally I don’t think that cool graphics should overcome performances. It’s like marketing against engineers. One want the sexy stuff and the other want the stuff that works well.

Leave a reply to Marco Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.