We are going to see the basic Introduction to Windows Presentation Foundation (WPF). This is a very basic article in the series of WPF tutorial. This article would cover few points about the WPF which includes summary of WPF history, why Microsoft introduced WPF and why WPF is better than Windows Forms applications.
|Introduction to WPF|
Microsoft released .Net framework 3.0 on 21-Nov-2006. No major architectural changes were included in .Net Framework 3.0 and it uses the same architecture and CLR (Common Language Runtime) as .Net Framework 2.0 does. However, this new framework included following 4 new major components along with WPF introduction.
- Windows Presentation Foundatation (WPF) : WPF formely known as Avalon. Microsoft introduced WPF as a new member of Windows based Application family. WPF mostly focuses on User Interfaces of windows application along with 3D graphics.
- Windows Communication Foundation (WCF) : This is a service oriented messaging system similar to Web Services. Earlier code named as Indigo.
- Windows Workflow Foundation (WWF) : A workflow based task automation and integrated transations system.
- Windows CardSpace
Introduction to Windows Presentation Foundation (WPF)
All .Net Framework versions prior to .Net Framework 3.0 were mostly relied on GDI/GDI+ subsystems. To get the introduction to Windows Presentation Foundation we should know these subsystems –
What is GDI & GDI+?
Graphics Device Interface (GDI/GDI+) is one of the older core system of Microsoft’s Windows Operating Systems. Microsoft introduced GDI/GDI+ as an interface for Windows Application Programming.
From the represantation of Graphical objects to the transmission of these object to few output devies like Monitor and Printer is the main responsibility of this GDI/GDI+ systems. It means GDI/GDI+ systems are responsible for task that involves some visual appearences like font rendering, line & curves drawing, bitmaps and palletes, etc. Simple multimedia activities like drawing a line does not require fast graphics and hence GDI can be used here.
However, these systems are not suitable for high performance multimedia operations such as Games, animations and rich visual effects.
Something was required that supports high performance multimedia activities and hence Microsoft introduced WPF. WPF is based on Direct3D and Direct3D is high performance system suitable for providing a visually stunning user interface.
What is GDI?
GDI was first introduced in 1985 with the first Microsoft version release. The idea behind the GDI is to create an abstraction of physical device, so the calling application doesn’t have to adjust its code for specific device. In other words, the same code that using GDI will be able to draw graphics on any GDI compatible device and it will look same each time. But the GDI has some drawbacks that it does not exposed to the advanced abilities of modern devices such as animation and rich visual effects, transforms, light sources, physics and more. This limitation is called as Inability to Rasterize 3D and this limitation makes GDI not suitable well for animations and rich visual effects.
What is GDI+?
To overcome the limitations of GDI, Microsoft brought GDI+, the successor of GDI in 2001 with release of Windows XP. GDI was expanded to GDI+ and it has some advanced features such as 2D vector graphics, Imaging capability, 2D anti-aliasing, Floating point coordinates and Alpha blend for colors. But still rendering the vector based graphics demands a lot of CPU usage because it is not hardware accelerated. Though GDI+ provides better rendering quality and clean code, it makes it slower than GDI. GDI/GDI+ is good in drawing windows and buttons but very CPU consuming and not hardware accelerated due to which windows leading to misbehaving software and frozen and unresponsive program operation. GDI/GDI+ is not suitable for high performance multimedia such as games.
What is DirectX/Direct3D?
To overcome the limitations of GDI/GDI+, Microsoft came with DirectX – a set of interfaces for direct access to video cards, sound devices and mouse to perform more optimized vector calculations, visual effects and more. The most important interfaces are Direct3D for rendering 3D graphics and DirectDraw (Direct2D) for rendering 2D graphics. Everything in Direct3D is hardware accelerated, many complex calculations performed by the CPU itself, to reduce the load on CPU. Direct3D makes a resolution independent and vector based applications to take advantages of modern graphics hardware.
What is WPF in .Net?
As mentioned above, Windows Presentation Foundation is nothing but a Graphical subsystem which provides visually stunning user interfaces in Windows based applications. WPF is based on XAML which is a XML based language. The architecture of WPF is spans across managed code and native code components.
- WPF is essentially a new API for creating a Graphical User Interfaces for the Windows Platform.
- WPF is more than just a next-generation presentation system for building Windows Client application along with visually stunning user interfaces.
- WPF is builds on top of the DirectX (Direct3D), instead of relying on the older GDI/GDI+ subsystem.
- WPF is a vector graphics based UI presentation layer and being vector based it allows the presentation layer to smoothly scale UI elements to any size without distortion.
- WPF is “skin-able” and “theme-able”. It means WPF allows changing the look and feel of any UI control.
- The core of WPF is a resolution independent and the vector based rendering engine takes the advantages of modern graphics hardware.
- The core of WPF is extended with a comprehensive set of application development features that includes Extensible Application Markup Language (XAML), controls, data binding, layout, 3D graphics, animations along with rich visual effects, templates, media, text etc.
- The most important feature of the WPF is – extended DataBinding. With WPF, you can perform data manipulation using .Net Framework Code, XAML or a combination of both. You can bind to controls, public properties, XML or objects, making data binding quick, flexible and easier than ever.
- WPF provides a consistent programming model for building applications and a clean separation between the user interfaces and the business logic. You may now separate the function of a control from its appearance.
- With WPF, you can build up complex UI elements from simpler one. Now you can build a new control which may have controls inside a control.
- With WPF, you can create a wide range of both stand-alone and browser-hosted applications.
I hope this article help you to get into the introduction to Windows Presentation Foundation. Please leave your valuable comments. It helps me to improve the quality of articles.
If you think article is worth to share then please share the article on your favourite social media.
More WPF Related articles …
- Overview of WPF Architecture.
- How to create WPF Application.
- How to handle events in WPF.
- Understanding Event handling in WPF.
- How to consume WCF service in WPF application.
- More WPF articles…