Multitouch "Hello World" program

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

CreateWpfProject.png

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

AddReference.png

In Window1.xaml add a new namespace: xmlns:mt="http://schemas.multitouch.com/Multitouch/2008/04", 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:

UsingMultitouchWindow.png

and cs file like this:

UsingMultitouchWindowCS.png

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.

FinalProgram.png

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.

ProgramRunning.png

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}.

ItemsControl.png

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))
{
	Photos.Add(file);
}


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.

PhotoAlbumCS.png

PhotoAlbumXaml.png

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