Difference Between WPF and Windows Forms

WPF vs. Windows Forms

Windows Presentation Foundation (also known as WPF) is a graphical subsystem. It is used in order to render user interfaces in Windows based applications. At its inception, WPF (known then as ‘Avalon’) was released as a part of the .NET Framework, version 3.0. It was then used to remove dependencies on the antiquated GDI subsystem. WPF is built on DirectX – this provides hardware acceleration. It also enables modern UI features – transparency, gradients and transforms, for example. It is a consistent programming model for building applications, and provides a definite separation between the user interface and the business logic therein.

Windows Forms is a graphical application programming interface (also known as the graphical API). It is a feature of the Windows .NET Framework, and provides access to the native Microsoft Windows interface elements. It accomplishes this task by wrapping the Windows API that is already in existence in managed code – that is, code requires, and will only execute under the management of the Common Language Runtime virtual machine, resulting in Bytecode. It is often considered a replacement for the C++ based Microsoft Foundation Class Library; however, it does not provide a model that is comparable to the model view controller (or MVC) – thusly, some after market and third party libraries have been created to compensate.

WPF offers a new markup language alternative, which is known as XAML. It is a different means of defining UI elements and relationships with other UI elements. An application that is defined as WPF is able to be deployed on the desktop, or hosted on a web browser. It is also able to handle rich control, design and development of the visual aspects of programs run by Windows. Its goals are specifically to unify a number of application services, including user interfaces, 2D and 3D drawings, fixed and adaptive documents, advanced typography, vector graphics, raster graphics, animation, data binding, audio, and video. WPF contains a plethora of features including, but not limited to, graphical services, data binding, layout and template options, and effects options.

Windows Forms is an event driven application that is supported by the Microsoft .NET Framework. What differentiates Windows Forms from standard batch programs is that it spends most of its time waiting for the user to initiate an action – filling in a text box or clicking a button, for instance. It is truly based on the user’s interaction with the computer. There is an alternative implementation of Windows Forms known as Mono. It is a project led by Novell, designed to create an Ecma standard compliant .NET compatible set of tools.

Summary:

1. WPF is a graphical subsystem that renders user interfaces in Windows based applications; Windows Forms is the graphical API that provides access to native Microsoft Windows interface elements.

2. WPF is a markup language alternative that defines UI elements and relationships with other UI elements; Windows Forms is an event driven application supported by the Microsoft .NET Framework.