views:

286

answers:

1

Im developing an app for Microsoft Surface and Im trying to make the most of the libraries that are out there, the functionality Im after if to be able to flick a UI element.

The ScatterView control makes this easy, but I would like to restrict the UI element to only be able to be flicked along a set path. This is where Im having trouble.

So my questions are:

1) Can you restrict a ScatterViewItem to only be flicked along a path?

2) If not, how would you implement a flick gesture to flick a UI element along a set path?

Thanks!

Mark

+3  A: 

1) Not that I know of, and this probably isn't the best way to approach it.

2) Assuming you have the object you want flicked and the path at design-time, I've previously implemented dragging and flicking along a path by creating a timeline animation that represents the movement across the entire path. At runtime, I capture contacts on that object, feed them to a Affine2DManipulationProcessor, and seek the animation based on the manipulation events.

So in my case I was creating a drawer. When the user touched the drawer, I start the animation and pause it immediately. If the user drags it open, I seek the animation the appropriate amount forward based on how far the manipulation processor tells me they've moved.

To get the flick behavior, you just hand off the manipulation to the Affine2DInertiaProcessor and continue handling the delta events.

This all works surprisingly well.

Ben Reierson
Thanks Ben, thats a good answer, I suppose as long as you calculate it correctly, the animation class would work ok. I was hesitent to use it because of the un-natural feel it could give the user...
Mark