I have “finished” my first version of a WPF multitouch ui layer, I have attached a binary release if people are interested in testing it out. Currently it uses OSC to receive data from touchlib, in the future could also use something like CSTI. It uses attached events to do all of its wiring up, no need for custom controls you can use any existing wpf control and it should support the full bubbling model. Available events, TouchDown, TouchUp, TouchMove, TouchDragEnter, TouchDragLeave, TouchDragOver, TouchDrop. It also supports “mouse emulation” where it will instead of reading from OSC translate mouse clicks into touch events....this obviously isnt multitouch but is useful for development when you can prototype some basic single touch interaction.
Usage
1. Add namespace:
using System.Windows.Input.Multitouch;
2. Initialize a TouchDispatcher( args: port, rootElement, highlightTouchPoints, emulateMouse, resolution ):
TouchDispatcher dispatcher = new TouchDispatcher( 3333, mainGrid, true, true, new Size( 1024, 768 ) );
3. Start receiving events (this is non blocking, does all of its receiving in another thread):
dispatcher.StartReceive();
4. Wire up the event:
XAML
a. Add namespace to your usercontrol:
xmlns:mt="http://schemas.nuigroup.com/wpf/ui"
b. Add event to any control
<Button Name="btnPlay" mt:TouchDispatcher.TouchUp="Play" Content="Play" />
c. Add Eventhandler in codebehind:
protected void Play( object sender, RoutedTouchEventArgs e )
{
}
Codebehind
a. Add namespace reference:
using System.Windows.Input.Multitouch;
b. Wire up event:
TouchDispatcher.AddTouchDownHandler( btnPlay, new RoutedTouchEventHandler( Play ) );
c. Add Eventhandler:
protected void Play( object sender, RoutedTouchEventArgs e )
{
}
It also supports drag/drop using TouchDispatcher.DoDragDrop()
I have tested the pieces that I am using directly a little, but some of the things are untested. I would be interested in any feedback people have, and also if other people were interested in collaborating a bit more so we can make 1 great framework for WPF.
