Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

A clear example of a gesture driven Windows Phone application

With last week's announcement of Windows 8 (which you can now catch on-demand here, Windows Phone Summit), it feels like a Mobile Monday kind of day.

With touch devices, like the Windows Phone, it's important that we take advantage of gestures, making them a integral part of our applications. You're thinking, "Easy for you to say, but how?"

Here's one example...

A gesture-driven Windows Phone to-do application

This blog post describes the implementation of a gesture-based todo-list application. The simple interface is controlled entirely by drag, flick and swipe:

So far the application supports deletion and completion of tasks, but not the addition of new ones. I’ll get to this in a later blog post!

Introduction – gestures, why don’t we use them more?

I think it is fair to say that most Windows Phone applications (and mobile applications in general) have user-interfaces that are a close reflection of how we interact with a desktop computer. Mobile applications have the same buttons, checkboxes and input controls as their desktop equivalent, with the user interacting with the majority of these controls via simple clicks / taps.

The mobile multi-touch interface allows for much more control and expression than a simple mouse pointer device. Standard gestures have been developed such as pinch/stretch, flick, pan, tap-and-hold, however these are quite rarely used; one notable exception being pinch/stretch which is the standard mechanism for manipulating images.
When an application comes along that makes great use of gestures, it really stands out from the crowds. One such application is the iPhone ‘Clear’ application, a simple todo-list with not one button or checkbox in sight. You can see the app in action below:

...

Interestingly, its use of pinch to navigate the three levels of menu is similar to the Windows 8 concept of ‘semantic zoom’.

When I first saw Clear – the clean, clutter-free interface immediately spoke ‘Metro’ to me! This blog post looks at how to recreate some of the features of Clear using Silverlight for Windows Phone, in order to create a gesture-driven todo application.

NOTE: All of the work on my blog is under a Creative Commons Share-alike license. For this blog post I just want to add that I do not want someone to take this code in order to release a ‘Clear’ clone on the Windows Phone marketplace. This blog post is for fun and education, to make people think more about the possibilities of gestures.

...

image

The post then continues on providing specific examples and details

Handling gestures

Silverlight for Windows Phone provides manipulation events which you can handle in order to track when a user places one or more fingers on the screen and moves them around. Turning low-level manipulation events into high-level gestures is actually quite tricky. Touch devices give a much greater control when dragging objects, or flicking them, but have a much lower accuracy for the more commonplace task of trying to hit a specific spot on the screen. For this reason, gestures have a built in tolerance. As an example, a drag manipulation gesture is not initiated if the user’s finger moves by a single pixel.

Fortunately, the Silverlight Toolkit contains a GestureListener which handles manipulation events and turns them into the standard gesture events for you. Unless you need a quite fancy gesture (two-finger-swipe for example), the GestureListener probably gives you all you need. To use this class, simply attach it to the element that you want to handle gestures on, then add handlers to the events that the GestureListener provides.

While the post provides a great series of code snaps, sometimes it's easier to see it as a complete project. Well Colin's got that covered as well and provided the complete project source.

image

If you download the source and run into a reference issue for the Microsoft.Phone.Controls.Toolkit (aka the Silverlight for Windows Phone Toolkit) assembly (shown below), the easiest way to fix that is via NuGet

image

Just search for silverlighttoolkitwp, add it to the project and you should be good to go.

image

Once I did that, the project ran for me the first time. Here's a snap of it running on my machine...

SNAGHTML375d5ba9

Want to add natural gesture support to your Windows Phone app? You'll want to check out this project...

Tags:

Follow the Discussion

  • Colin EColin E

    Hi Greg, thanks for highlighting this blog post. Part two is now up, where I add drag re-ordering:

    http://www.scottlogic.co.uk/blog/colin/2012/06/a-gesture-driven-windows-phone-todo-application-part-two-drag-re-ordering/

    Regards, Colin E.

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @Colin E: Nice, thanks Colin!

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.