Multitouch in WP7

I just published an app. (You can check it out hereĀ http://underbridgecity.net/underbridgegraffiti/.) Has the ability to allow more then one finger to interact with the screen at one time. Here is how I was able to set it up on a canvas which is set up in the xaml.

So to get multitouch set up I used a TouchFrameEventhandler. You will have to add

as a reference and a using statment.

I created a class called DrawingPoints and then created a list collection of them.

Now you will need to create the touchevent that will happen when something touches the screen.

What that does is everytime a finger touches the screen in the canvas element(which takes up the whole screen on a page in my app,) a touchpoint gets added to a touch collection.
Then for each touch in the touch collection, the code checks what the action of the touch is, it will either be Up – finger leaves the screen, Down – finger touches the screen or Move – finger is moving on the screen. When the action is Up it removes the draw point and stops drawing. When Down is adds a drawpoint to the drawpoint collection and gets ready for the move action. When it is moving it draws a line from the point the finger was at, to the point the finger is at now.

Now you have to add the event when you go to the page you want multi touch on, and when you leave the page remove the event. To do this I override the navigation events. Now I remove the event when leaving the page becasue the touch events can cause some weird things to happen on other pages in the application.

So that is how I got multitouch set up in my application. Any questions email me or leave a comment.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">