Skip to content

WPF vs. Windows Forms

jbe2277 edited this page Dec 9, 2017 · 3 revisions

The .NET Framework comes with two different GUI technologies for developing Windows Desktop applications:

  • WPF (Windows Presentation Foundation)
  • WinForms (Windows Forms)

The following comparison table shows how these GUI technologies differentiate from each other:

Topic Windows Forms WPF
Introduced in 2001 (.NET Framework 1.0) 2006 (.NET Framework 3.0)
System Requirements >= Windows 98 >= Windows XP
Technology Layer on top of standard Windows controls (Win32) WPF is built from scratch with more than 80% managed code
Rendering Pixel graphic UI based on GDI+ Vector graphic UI based on DirectX
Customization
  • Limited to the behavior and look & feel of Windows Forms controls.
  • Extending the behavior needs often to use Win32 API calls.
  • 3rd party libraries provide more flexible controls.
  • Very flexible and powerful to adapt and restyle UI controls.
  • Adaption of control behavior can be done with .NET API.
Styling / Theming Styling is quite limited with the standard controls. Styling support is very powerful. But it’s also complex.
UI Definition Procedural: C#/VB code (generated by the GUI designer) Declarative: XAML (XML dialect); More control over the code created by the designer
Supporting separation of concerns
  • Provides databinding
Long term support Yes. Windows Forms is part of the .NET Framework. Yes. WPF is part of the .NET Framework.
Mature Yes. This technology is in maintenance mode. Innovative improvements are not expected anymore. Yes. This technology is in maintenance mode. Innovative improvements are not expected anymore.
Tool support Visual Studio Windows Forms designer Visual Studio XAML designer; Expression Blend
Known drawbacks
  • Issues with high resolution displays because pixel graphic rendering does not scale well.
  • Generated code by VS Designer is hard to merge when merge conflicts exist.
  • The learning curve is quite steep.
  • Slower than Windows Forms because of a more complex UI stack.

Here are some characteristics shared by both UI technologies:

  • Supported device types: PC, Notebook, Tablet
  • User interaction: Optimized for keyboard and mouse
  • Deployment:
    • XCopy deployment
    • ClickOnce deployment
    • Classic installers (MSI, …)
  • Distribution: No limitations. Does not depend on an App Store.
  • Resource access: Applications can access all resources the user has permission for (e.g. file system).
Clone this wiki locally