Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between WPF and WinForms?

Tags:

winforms

wpf

I am programming simple Windows apps. I don't need DB support. Why would I use WPF instead of WinForms?

like image 898
Alex Gordon Avatar asked Aug 26 '09 20:08

Alex Gordon


People also ask

Should I use Winform or WPF?

WinForms and WPF are both great frameworks the question is what is best suited to your application. If you need a fluid gui with animated controls and very themable styles, or are just creating a very graphical user interface WPF is very good for that kind of application.

What is difference between WinForms and Windows Forms?

Winforms and Windows Forms are the same thing. Winforms is the shortened name for Windows Forms.

What is better than Windows Forms?

Advantages of using WPF instead of Windows forms: XAML makes it easy to create and edit your GUI, and allows the work to be split between a designer (XAML) and a programmer (C#, VB.NET etc.). It allows you to make user interfaces for both Windows applications and web applications (Silverlight/XBAP).


2 Answers

WPF is the current platform for developing Windows desktop applications. It is a modern, advanced, hardware accelerated framework for developing applications that maintain separation of concerns. It supports advanced rendering of 2D vector and 3D graphics, providing an immense range of capabilities for building rich, interactive, and quality user interfaces.

WinForms, on the other hand, provides a basic platform for developing "classic" Windows apps with your standard look and feel using standard controls. It does not offer the rich, hardware accelerated, vector 2D and 3D capabilities that WPF offers. WinForms applications tend to have much greater coupling between application behavior and UI (view), which presents a less flexible platform upon which to develop applications.

As for which one you choose, it entirely depends on your needs. If you need vector graphics, 3D rendering, the ability to create rich, interactive, animated, modern user interfaces, and/or wish to maintain separation of concerns, WPF is definitely the right choice. If you need none of that, and just need to create a simple UI that solves a simple problem, WinForms will meet your needs just fine.

like image 24
jrista Avatar answered Sep 22 '22 13:09

jrista


One obvious answer is that WPF offers a richer user experience than WinForms, allowing for animations (even 3D) in the user interface, for example.

From a development perspective, it goes a long way to enforce the separation of the User Interface (in the XAML) from the business logic (in VB.NET or C#), which is always a good thing.

A Google search for "WPF vs WinForms" brings up lots of pages that discuss this issue. I won't repeat all their findings here, but this page raises some interesting points:

  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.
like image 82
ChrisF Avatar answered Sep 21 '22 13:09

ChrisF