This project has moved and is read-only. For the latest updates, please go here.

Multitouch "Hello World" program

Start Visual Studio and create a new WPF project and name it "MultitouchHelloWorld".


Add reference to Multitouch.Framework.WPF.dll assembly.


In Window1.xaml add a new namespace: xmlns:mt="", and change root object <Window> to <mt:Window>. Don't forget to close it with </mt:Window>. Then open Window1.cs and change Window1 base object from Window to Multitouch.Framework.WPF.Controls.Window_.
Your xaml should look like this:


and cs file like this:


Now add a TouchablePanel as a child of Grid and TextBlock as a child of TouchablePanel. Set the Text property of TextBlock to "Hello World!!!".
Let's make this text bigger, so we could easily touch it. Set FontSize property to 72, FontWeight to Bold and make Foreground White and Background LightBlue.


Our program is ready. Before you start it, you have to start multitouch service. For example by executing Multitouch.Service.Console.exe.
Now hit F5 to start the program. Your program will look like this and you can touch the text and move and rotate it around.


Let's make our program a little more useful. Replace TouchablePanel with ItemsControl and set its ItemsPanel to TouchablePanel. Now bind ItemsSource to Photos property with {Binding Photos}.


Now let's write some code. Open Window1.cs file. And add a new DependencyProperty Photos of type ObservableCollection<string>. In constructor, before InitializeComponent is executed, set DataContext to this. Now override OnInitialized_ method and add this code:

foreach(string file in Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "*.jpg").Take(5))

It will take 5 pictures from you Pictures folder, so make sure you have them.
Finally let's get back to Window1.xaml and add a DataTemplate to display strings as Images.



Now start the program and enjoy your Multitouch Photo Album :)

Last edited May 24, 2008 at 1:14 PM by nesher, version 8


DaksGreenday Mar 13, 2013 at 9:39 PM 
Hello, we got this tutorial working just fine and it looks great. My question is whether anyone has been able to add or change a photo after they are rendered? We are currently trying to make this possible but are having no luck due to binding issues. Any ideas?

jeffman1 Aug 24, 2011 at 4:53 PM 
question can this make the kinect act a multiple emulated mice because i want to test it with the quiz sample.

kasmatt Jul 2, 2009 at 2:50 PM 
This is owesome. Just tried it on windows 7RC. Just the one thing, how do I use the media element in the touchable panel. Every time I use it I get an error when running it. Any Ideas.

ShacharWeis May 21, 2009 at 8:02 AM 
Hello everyone,

I just managed to get the helloworld application running.
I see nice green dots where I touch, but the "Hello World" textbox is very sluggish and its
very hard to move it, it feels heavy and unresponsive.
I dont understand why, are there some parameters to change this behavior ?

Shachar Weis.

rad_thundercat Mar 23, 2009 at 7:17 PM 
I found the problem. "System.Collections.ObjectModel; and
System.IO; need to be added to the .cs.

rad_thundercat Mar 23, 2009 at 6:08 PM 
After following all of this I'm getting, "The type or namespace name 'ObservableCollection' could not be found (are you missing a using directive or an assembly reference?)" in the Window1.xaml.cs file

There is just one error, however, none of the "(ObservableCollection<string>)" lines are turning light-blue like in the screenshots above. I'm using Visual C# Express Edition -is this a limitation?

mr_empty Nov 20, 2008 at 9:02 PM 
Thanks for the tutorial, however I get "mt' is an undeclared namespace. Any ideas?

nickdb93 Jun 23, 2008 at 6:15 PM 
you guys should make videos to accompany these things, and post them on youtube. that would really help ppl, and drum up some mor interest in your project from other developers. i know it would help me.

nickdb93 Jun 23, 2008 at 5:58 PM 
wait.......what source code do i have to download to get Multitouch.Framework.WPF.dll ?