I’ve finally gotten around to actually playing with Windows Presentation Foundation in Visual Studio and I’m really blown away by the capabilities. As a GUI guy, I can totally appreciate all the work they’ve put into this framework and I am relieved to see most of the problems with GDI+/Windows Forms being addressed. WPF will definitely mean more impressive looking user interfaces that will make “web 2.0” look like DOS.

But what does this mean exactly for Tablet PC’s? Well, with the recent announcements about Origami devices, the landscape is certainly changing drastically. No longer can a Tablet PC developer assume that his application will run in 1024×768 at 96dpi. Even with the Toshiba M200 and other large screen tablets this is already a problem (although it’s a lot easier to deal with more screen real estate than less).

Resolution-independent applications

The first way you can make your applications deal with different resolutions is to create adaptive layouts. That is, make sure your controls stretch when the window is stretched. In some cases, you can have wrapping UI elements or split containers. This is all possible today in Windows Forms. But it doesn’t solve the issue of high density screens that pack lots of pixels into a small physical area. The problem here is that the same application on 1024×768 at 96dpi looks terribly small on a screen with a much higher physical DPI.

The solution is to stop thinking in terms of pixels and start thinking in terms of real world coordinates like inches. Traditionally, this has been very hard to do in Windows programming. Sure, GDI and GDI+ have scale transformations and alternate coordinate systems, but the underlying Windows subsystem does not have this capability, making it practically useless for controls. In WPF, though, everything is consistent. A virtual coordinate system in WPF works great because you can layout your user interface in a predictable size and then if the resolution (number of pixels) or DPI (pixels per inch) changes, your user interface can scale uniformly and still be usable, with no additional work by you, other than applying the scale. The result is just like if you resize a flash movie.

Consistent visual styles

The other problem with developing Tablet PC applications in Windows Forms is that there is no clear user interface guideline for these kinds of devices. For example, the Origami devices seem to be touch-focused rather than pen-focused. If your application is going to run on these devices, you probably want to make sure your UI elements are suitable for fingertips which are bigger and blunter than a stylus (unless you’re a child, a very thin woman, or a really feminine guy, or a gynecologist, etc…) but what is the right size? What works best?

Why does every new Tablet PC programmer have to research this? And once they do, applying these guidelines consistently across a Windows Forms application is not trivial. But with WPF’s style support, you can “skin” your controls just as easily as you would with CSS on the web. I envision some brilliant WPF-minded people at Microsoft will come up with some great style resources which can just be dropped into your WPF form. They might look similar to the look and feel of the Tablet PC Education Pack which has beautiful, large buttons and attractive gradients. I want more applications to look like that and WPF can make it happen.

Ink is a first-class citizen

This really took me by surprise. But in WPF, ink is just built in. It’s in the same runtime as the rest of the presentation components and all of the UI elements that I have seen expose support for the RealTimeStylus API which provides low-level stylus input capabilities. So it’s easy to tell if you were clicked by a pen/finger or clicked by a mouse.

Also collecting and rendering ink has all of the same presentation capabilities such as the render transformations, animation, 3D, etc. But I suspect this will not be as broadly useful as the other capabilities. But it might make for some really cool visual effects for the TEO controls!

Anyway, bottom line is… If you’re thinking about developing applications that will run on these wide variety of devices, you need to consider Windows Presentation Foundation. It’s available for Windows XP and Windows Vista and is currently in beta.