Saturday, February 18, 2012

When should I use WPF...?

 When should I use WPF instead of DirectX? (Is DirectX dead?)

DirectX is definitely not dead and is still more appropriate than WPF for advanced developers writing hard-core “twitch games” or applications with complex 3D models where you need maximum performance. That said, it’s easy to write a naive DirectX application that performs far worse than a similar WPF application.
DirectX is a low-level interface to the graphics hardware that exposes all of the quirks of
whatever GPU a particular computer has. DirectX can be thought of as assembly language in
the world of graphics: You can do anything the GPU supports.

WPF provides a high-level abstraction that takes a description of your scene and
figures out the best way to render it, given the hardware resources available. Internally, this
might involve using Shader Model 3.0, or the fixed-function pipeline, or software. (Don’t worry if you’re not familiar with these terms, but take it as a sign that you should be using WPF!).

The downside of choosing DirectX over WPF is a potentially astronomical increase in development cost. A large part of this cost is the requirement to test your application on each
driver/GPU combination you intend to support. One of the major benefits of building on top of WPF is that Microsoft has already done this testing for you! You can instead focus your
testing on low-end hardware for measuring performance. The fact that WPF applications can
even leverage the client GPU over Remote Desktop or in a partial-trust environment is also a
compelling differentiator.

When should I use WPF instead of Windows Forms?(Is Windows Forms dead?)

WPF is clearly more suitable for applications with rich media, but some people have said that Windows Forms is the best choice for business applications with traditional user interfaces. I think this belief is based on first versions of WPF in which many standard controls didn’t exist (such as TreeView, ListView, and OpenFileDialog) and a visual designer didn’t exist, making traditional Windows application development in WPF harder than in Windows Forms. Although Windows Forms still has useful controls that WPF lacks (such as DataGridView and PropertyGrid) and at the time of writing has a larger set of third-party controls in the marketplace, WPF has compelling features even for traditional user interfaces (such as the support for resolution independence or advanced layout).

When should I use WPF instead of Adobe Flash?

For creating rich web content, Flash is currently the most popular option because of its ubiquity.
You can put Flash-based content on a website with confidence that the overwhelming
majority of visitors already have the necessary player installed. (And if they don’t, it’s a very
quick download.)

WPF applications can also run within a web browser. WPF has the advantage of better development
tools and programming model, a richer feature set, robust control reuse, broad
programming language support, and full access to the underlying platform (when security
permits). But viewing such content requires Windows and the .NET Framework 3.0 (installed
by default on Windows Vista or later).

No comments:

Post a Comment