Sunday, August 7, 2011

Kinect Multitouch Device for WPF 4 (Preview)

I'm working on a KinectMultiTouchDevice class which will create WPF 4 TouchDevices for touch input.

Here's a code snippet that shows how you will be able to intialize the device (inside the load method of a WPF 4 window):

 this.factory = new OpenNIDataSourceFactory("config.xml");  
 var handDataSource = new HandDataSource(this.factory.CreateClusterDataSource());  
 this.multiTouchDevice = new KinectMultiTouchDevice(handDataSource, this);  

Then you can use the following events of the UIElement class:
  • public event EventHandler<TouchEventArgs> TouchEnter;
  • public event EventHandler<TouchEventArgs> TouchLeave;
  • public event EventHandler<TouchEventArgs> TouchMove;
  • public event EventHandler<TouchEventArgs> TouchUp;
This is a small sample that draws lines between two touch move events. It's based on WpfTouchEventsSample that can be found here

In this video multiple finger devices are used simultaneously (the lines are always drawn between the last two reported points)

I'm also working on a more sophisticated sample that I can share together with the KinectMultiTouchDevice class.


    1. Great work across the board! This project looks fun, I'll be sure to post up some gallery shots if you release a class for this.

    2. Amazing! Amazing, I'm so excited to try this out. just a few more days of work to finish.

    3. will you be able to try out the Surface SDK using the Kinect?

    4. Hi EddHead

      It works with the WPF samples in the Surface SDK. I haven't found out (yet?) how to use the TouchDevice with the XNA samples.