Page 2 of 6
There are lots of reasons, however, why WPF is the way forward and one of the most important is that it makes use of the modern video hardware nearly all machines have.
The Windows Forms API was invented in the days when graphics cards were simple and it makes very little use of hardware graphics acceleration. WPF, on the other hand, uses the DirectX 9 rendering engine and this does make use of graphics acceleration. It also means that WPF has access to a wide range of visual effects for full 3D presentation, including meshes, materials, lights, textures and so on.
Yes, WPF provides you with yet another way of creating 3D graphics under Windows!
At a more mundane level all of the elements of any UI you create using WPF are rendered using vector graphics, rather than bitmaps, and this means that they display at the highest resolution the display device supports. It makes the user interface much more device independent than the old way of working, which often resulted in silly sizes or arrangements of controls if the user was working with a different video resolution to that of the original programmer.
It is also a “retained” mode graphics system which makes anything you draw on a form persistent without you having to redraw it. For example, if you draw a line on a form and the form is minimised the line is still there when the form is restored and you don’t have to redraw it. Retained mode allows the graphics system to optimise the display process.
You might also guess that XAML can be used to create web applications via a browser add-in. In fact there are two distinct types of WPF application, Navigation Window and Document Window. A Navigation Window provides hyperlinks to allow the user to move through the application, whereas a Document Window is more like a traditional application. WPF can also be used on reduced hardware and mobile devices and in time it is destined to be the only way of creating user interfaces and graphics under all versions of Windows. In addition there is Silverlight which is a browser plugin that will render XAML and run .NET code.
The downside is that you now have XAML - a language for object creation and initialisation - in addition to whatever language you are writing in and this brings with it problems of integration between the two. Most of the time you can ignore XAML, just as you ignored the code generated by the original Windows forms designers, but sometimes you can't. XAML goes well beyond static controls and objects. XAML has more and so does the .NET WPF frame work. For these reasons it useful to look a little deeper.