none
WPF vs. Windows Forms 2015 RRS feed

  • Question

  • Hey Guys, 

    i'll start a new project next month, its about a usual business application. Add, Edit, Delete, some controls, a few grids, save to and load from database, nothing special...

    I read many threads about wpf vs windows forms, but all of them are older than 5 years. So i want to start this discussion again in 2015.

    Windows Forms is feature complete. Not perfect, but everything you need is in there. WPF is great, you can do a lot of graphical tricks (e.g. rotate checkbox). But in an business app, i do not need all of that playing. Even just put the text on the left side on a WPF-checkbox needs me a whole page of code.

    So my question is. Is Windows Forms really dead? How long will it be supported? What do you think about writing a new business app in Windows Forms?

    (Please dont tell me anything about html, cloud, java script or mobile platforms! Only WPF vs. Windows Forms)

    Nico


    VB.NET & C#.NET

    Monday, March 9, 2015 8:29 AM

Answers

All replies

  • >>Is Windows Forms really dead?

    No, it is not dead. Microsoft is still working on it although you cannot expect to see as many new features being added to it compared to newer and less mature technologies such as for example Windows Store Apps.

    For example the .NET Framework 4.5.2 included high DPI support an initial set of Windows Forms controls: http://blogs.msdn.com/b/dotnet/archive/2014/11/12/announcing-net-2015-preview-a-new-era-for-net.aspx.

    >>How long will it be supported?

    There is currently no end date for the support of Windows Forms applications. No one knows how long it will be supported but since it is still being worked on you can expect it to be supported for a long time.

    >>What do you think about writing a new business app in Windows Forms?

    It is perfectly fine to write a new line of business app for the desktop using Windows Forms in 2015. I prefer WPF myself but that's just a personal personal flavour. Please refer to the following links for some comparisons between WPF and Windows Forms:

    http://www.wpf-tutorial.com/about-wpf/wpf-vs-winforms/
    http://stackoverflow.com/questions/885266/wpf-vs-windows-forms
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/42636e55-a1e0-4b29-bbd1-cd8073585584/wpf-vs-windows-forms?forum=wpf
    https://joshsmithonwpf.wordpress.com/2007/09/05/wpf-vs-windows-forms/
    https://social.msdn.microsoft.com/Forums/en-US/d19ad81f-ef1d-4105-a720-f8fba30a3c97/moving-from-winforms-to-wpf?forum=wpf

     

    Please remember to close the thread by marking all helpful posts as answer and please start a new thread if you have a new question.

    • Marked as answer by Nico F. _ Tuesday, March 10, 2015 7:03 AM
    Monday, March 9, 2015 9:15 AM
  • Windows Forms is feature complete. Not perfect, but everything you need is in there. WPF is great, you can do a lot of graphical tricks (e.g. rotate checkbox). But in an business app, i do not need all of that playing.

    Yeah I agree. I don't need to see it either and would never use it. With WPF and bussiness application needs it's,  about Serperation of duties as discussed in the link.

    http://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC-MVP

    You could always do Seperation of duties with just straight up MVP in a Windows form based solution, but most Windows form develpers didn't or don't know about the power of MVP,  and what it does when implemented in a UI. Abdd it doesn't matter if MVP was used in a  Windows, ASP.NET, Sliverlight or WPF form based solution, becuase MVP can be used in all of them.

    But there is MVPVM.

    https://documentation.devexpress.com/#WindowsForms/CustomDocument17232

    http://aviadezra.blogspot.com/2009/08/mvp-mvvm-winforms-data-binding.html

    http://www.codeproject.com/Articles/88390/MVP-VM-Model-View-Presenter-ViewModel-with-Data-Bi

    • Marked as answer by Nico F. _ Tuesday, March 10, 2015 7:03 AM
    Monday, March 9, 2015 6:13 PM
  • I get the impression ( Nico ) that you know windows forms and don't know wpf so well.

    If that's the case then the learning curve involved in taking up WPF is considerable and ought to be taken into account in your consideration.

    On a personal note.

    I think the future will be some sort of improved version of windows store app type of XAML.

    That's where most effort is going.

    Therefore you might find personal advantage in learning XAML.

    .

    Personally, I prefer wpf anyhow but I climbed up that learning curve a while back.


    Hope that helps.
    Recent Technet articles: Property List Editing; Dynamic XAML

    Monday, March 9, 2015 6:42 PM
    Moderator
  • Thanks guys, that helps a lot. Knowing that WinForm is still alive and will be supported is great

    well, i played around with wpf and xaml for some month, so i basically know xaml and can design some views. but my current problem (just put the text of a checkbox on the left side) let come up the question, is WPF really the best for just a business application. Rotating the checkbox is done with one click. that would be very tricky in winforms, but putting this text on the left needs around one page of code... For What??

    so thanks again, wish you a nice week.

    Nico


    VB.NET & C#.NET

    Tuesday, March 10, 2015 7:09 AM
  • On that specific checkbox thing.

    You could just cut and paste a template does that in like 20 seconds.

    http://www.codeproject.com/Articles/19141/WPF-Checkbox-Text-On-Left-Side

    .

    My advice is still to stick to what you know unless you have a good reason.

    If your business is where you'll be staying for some time and they're happy with winforms style apps then go with it.


    Hope that helps.
    Recent Technet articles: Property List Editing; Dynamic XAML

    Tuesday, March 10, 2015 7:49 AM
    Moderator
  • In order to have text on the left, you only need to add 

    FlowDirection="RightToLeft"

    to your checkbox declaration. Same is for Radios.

    Not sure if this is also possible in designer (it was in WinForms).

    • Edited by teejay87 Friday, March 3, 2017 11:31 AM
    Friday, March 3, 2017 11:30 AM
  • I still use WPF (but more specifically WPF with MVVM architecture) for small "LOB" type apps like you describe simply for the fact that YOU CAN UNIT TEST THE BUSINESS LOGIC MUCH EASIER!  This is important in so many situations that you can't ignore it.
    Friday, March 3, 2017 11:46 PM
  • Hey teejay, 

    this is not working, because this will also turn the check mark.

    Nico


    VB.NET & C#.NET

    Monday, March 6, 2017 9:19 AM
  • Hey clawton, 

    yea, testing is very important, but if you design your winforms app with a good architecture (MVVM is here also possible), then testing is no problem.

    so if i put all together, i'm still fine with WinForms.

    Thanks for all your answers.

    Nico


    VB.NET & C#.NET

    Monday, March 6, 2017 9:20 AM
  • Hi Nico,

    IMHO using WinForms is deprecated: why do use an obsolete programming library for UI, when with WPF you can achive practically any layout, based on vector graphics ? But the key point is that you must known WPF very well.

    For example, to achive your requirement, you need 20 seconds: open your xaml file with blend, edit the control template changing the grid column of the border that has the "check" and the grid column of the content presenter object. Thats all.

    <Border x:Name="checkBoxBorder" Grid.Column="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
     <Grid x:Name="markGrid">
       <Path x:Name="optionMark" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="{StaticResource OptionMark.Static.Glyph}" Margin="1" Opacity="0" Stretch="None"/>
        <Rectangle x:Name="indeterminateMark" Fill="{StaticResource OptionMark.Static.Glyph}" Margin="2" Opacity="0"/>
     </Grid>
    </Border>
    <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

    Moreover, saving this template in a resource dictionary, you can reuse it.

    I hope this help you to make a right choice.

    Regards,

    Simone

    Monday, March 6, 2017 9:49 AM