Gesture behavior

Oct 18, 2010 at 12:35 AM
Edited Oct 18, 2010 at 12:36 AM

Hi all,

I'm kinda new to SilverLight but have been playing around with the WP7 SDK. I found it a bit surprising that a WP7 (non-XNA) apps only had the Manipulation overrides available to recognize touch input. Luckily the the SilverLight Toolkit is available to fill the gap. The one thing I don't see in the toolkit is a Behavior to make it easier to bind to a view model. So I wrapped the toolkit GestureListener in a Behavior with associated triggers so that you can bind Gesture to a ViewModel rather than directly to a View:

    <Grid>
        <i:Interaction.Behaviors>
            <li:GestureBehavior/>
        </i:Interaction.Behaviors>
        <i:Interaction.Triggers>
            <li:FlickTrigger>
                <cmd:EventToCommand Command="{Binding FlickCommand}" PassEventArgsToCommand="True"/>
            </li:FlickTrigger>
            <li:DoubleTapTrigger>
                <cmd:EventToCommand Command="{Binding DoubleTapCommand}" PassEventArgsToCommand="True"/>
            </li:DoubleTapTrigger>
        </i:Interaction.Triggers>
    </Grid>

 

Honestly, being newish to all things WPFy I'm not sure if this is the correct approach but I couldn't figure out how to make it work otherwise.

Anyway if anyone is interested in such a thing I can share the code.

Jan 4, 2011 at 12:05 PM

Hi, i'm really interested in your solution for this. Can you pass me the sourcecode?

Jan 4, 2011 at 12:11 PM

Sure. Private message me your email address and i'll send it along.