Ah but this isn’t a simple consideration. As I’ve been digging in, getting ready to build my first Windows 7 multi touch application, I’ve found out just how much I have to learn! For starters I am by no means an expert in WPF (Windows Presentation Foundation) development. This is, of course, the core of any Windows application UX. Because I have done quite a bit of work in Silverlight, I thought I could use my work there as a basis for working in WPF. Well, that’s kind of right – both technologies do use XAML and I can work in either Expression Blend or Visual Studio, but, well, there’s a whole lot that is not common between the two. I found this great whitepaper on CodePlex on just that topic, i.e. ‘Microsoft Silverlight / WPF Comparison Whitepaper’ that I recommend you read if you have been working in Silverlight, but not WPF.
If you haven’t been working in either SL or WPF, then you’ll need to get some basics of WPF first. How you get that depends on how you like to learn. I usually start with a book, then watch some webcasts, then work on some hands-on-labs. By the time I get to the last one, I am usually messing around building stuff.
For a WPF book, I like ‘Programming WPF’ by Chris Sells and Ian Griffiths
There are quite a few short screencast-style videos on WPF on the Windows Client site. You’ll certainly want to see the one on how use XAML in WPF.
The Windows Client site also contains WPF hands on labs – for some you use Visual Studio, for others you use Expression Blend. Nothing beats actual coding for learning, does it?
Now, there are of course other ways to learn WPF, for example our own local RD and MVP Paul Sherriff will be presenting a series of FREE events around SoCal this summer and fall around WPF development. He also plans to host these events via the web for those of you who can’t make it to his live events (watch my blog for dates). Also, I’ve been featuring WPF developers on MSDN geekSpeak lately. This week (Wed – noon PST) we host Robert Altland from Neudesic on WPF Accessibility coding for example. It is only AFTER you have a basic understanding of WPF, that you can begin to think about how you are going to code your multi touch application.
One other possible consideration is whether you’ve done any programming on the MS-Surface API. I realize that a very small subset of developers have actually worked with this, however, if you have, then you’ll be interested to know that we announced that we intend to eventually aim for convergence between the touch APIs in the .NET framework 4.0 and those in the MS-Surface 2.0 (via a combination of wrappers and API re-work). Here are a couple of architectural diagrams to clarify – first is where we are now, i.e. Vista and MS Surface 1.0.
Next is the Windows 7 release. Of course, we’ve announced that October 22, 2009 will be the release date for this. You’ll note that we’ll be including the core Multi-Touch API in Windows 7.
After the Windows 7 release, we’ll be releasing both Visual Studio 2010 with .NET Framework 4.0 and also the MS Surface 2.0. You can see that WPF 4.0 will include Multi-Touch APIs and Controls. You’ll also note that the Surface SDK 2.0 will include an updated version of the Multi-Touch API and Controls.
If you wish to code multi touch applications for Windows 7 now, then you have two choices at present. The first is to use .NET framework 3.5 (on Visual Studio 2008) and wrappers that we provide that allow you to code ‘multi-touch-like capabilities’. The ‘good news’ about this solution is that you can use it now to get a jump start on Windows 7 application development. The ‘bad news’ is that the programming model for multi touch applications will change in the .NET framework 4.0. You can, of course get a beta of Visual Studio 2010 which includes the .NET framework 4.0, so if you wanted to, you could start working with the multi touch APIs in WPF 4.0 from the beta now.
Although there is some information out there on Windows 7 multi touch application development using .NET framework 4.0 – notably a series of multi touch videos on MSDN Channel 9, I am going to use the .NET framework 3.5 to create my first application. My primary reason is a practical one, that is, as I mentioned in a previous blog post, in addition to being an educational exercise, my intent with this first application is also practical – I want to actually use it at the next few WomenBuild events. To that end, the less beta software the better, right?
Now that I’ve decided which platform and development environment(s), I am FINALLY writing some code! Today I am working through the newly-released Windows 7 RC Training Kit for Developers (as well as hacking around in the other multi touch samples that I’ve got installed on this laptop).
The very first thing you’ll want to do is to verify that your hardware will supports multi touch. To do this you’ll need to use the Windows 7 Integration Library Sample (included in the training kit linked above) which includes some helper .dlls that allow you to write code that picks up stylus events.
To get started create a new Windows>WPF application project in your favorite language (I’ll be using C#) and add references to the two helper .dlls named Windows7.Multitouch and Windows7.Multitouch.WPF as shown below.
Next add a new item to your project, a WPF>Page, name it ‘MainWindow.xaml’, Then in your MainWindow constructor (in MainWindow.xaml.cs), add the code shown below (ending in .IsMultiTouchReady). Compile and run your project and, of course, you are looking for the window shown below.
MessageBox.Show("Multitouch is available");
Whew – what a lot of preparation BEFORE coding. As this blog series continues, I’ll be digging into the details of coding to support multi touch applications.
I’m scheduled for two upcoming presentations on Windows 7 multi touch applications. One is this Friday morning, it is for Microsoft Certified Trainers only (at the MCT virtual summit). So, if you are a MCT and are reading this – join me Friday, June 19th at 9am PST. This session will also be recorded for all MCTs.
Monday, June 22 at 6:30 I am hosting a Windows 7 / Surface demo-fest for Designers at the Microsoft Irvine office. You must register if you wish to attend, send me mail via this blog if interested in attending and I’ll get you on the list.
Also, I’ll be presenting the ‘Windows 7 Multi Touch Application Development’ session at SoCalCodeCamp at UCSD in San Diego on Sat, June 27 (sometime in the afternoon, watch the site for the schedule) as well.
Last but not least, I’ll be at the Windows 7 Installfest at QuickStart Irvine this Thursday, from 1pm to 5pm. I’ll be there to install Windows 7 RC on my NEW 64-bit HP TouchSmart tx2 (thanks to Scott Kerfoot!). Up until this point, I have been working on a 32-bit version of the same machine.