This project is read-only.


A gesture is a specific set of input that can be configured to trigger a command. An example of a gesture would be the click of a button or the flick of a mouse.

Included Gestures

  • Button Down - Triggered when a button component is depressed.
  • Button Press - Triggered when a button component is depressed and released.
  • Double Press - Triggered when a button is pressed twice rapidly in succession.
  • Press and Hold - Triggered when a button is pressed and held for a fixed duration.
  • Button Track - A quantified gesture that is triggered when a button is pressed or released. Information on whether it was a press or a release is supplied to the command.
  • Delta - Triggers when a delta component is altered. Reports the delta value of the component to the command.
  • Flick - Triggered when a positional component is quickly shifted up, down, left, or right while a button is pressed.
  • Position Changed - Triggered when a positional device is moved. Reports the position of the positional device component.
  • Trigger Down - Triggered when an analog trigger is pushed past a certain threshold.
  • Joystick Position Change - Triggered when an analog joystick is moved.

Extending Gestures

To create a new gesture inherit from the abstract Gesture class and decorate with the GestureAttribute. The IsGestureActived method must be implemented -- this will be called each time a device is updated. All user defined properties should must be exposed through public properties and decorated with the UserPropertyAttribute. If the type of a property is not a primitive type a property converter and a property setter user control must be supplied. Quantified gestures must implement the IQuantifiedGestures interface and supply values to commands via a weakly typed string dictionary.


public class ButtonDownGesture : Gesture
    Boolean _isPressed;

    public ButtonDeviceComponent Button { get; set; }

    public ButtonDownGesture()
        _isPressed = false;

    public override Boolean IsGestureActivated()
        if (Button == null)
            return false;

        if (Button.State != ButtonState.Down)
            _isPressed = false;
            return false;

        if (_isPressed)
            return false;

        _isPressed = true;
        return true;

Last edited Dec 2, 2009 at 1:42 AM by PhilipB, version 6


No comments yet.