Skip to content

Instantly share code, notes, and snippets.

@mecab
Created May 27, 2012 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mecab/2802529 to your computer and use it in GitHub Desktop.
Save mecab/2802529 to your computer and use it in GitHub Desktop.
Sample code of fixing strange slider behivor with GestureService (code-behind)
using System.Windows.Input;
using Microsoft.Phone.Controls;
using Microsoft.Xna.Framework.Input.Touch;
namespace SliderWithGestureService {
public partial class MainPage : PhoneApplicationPage {
// Constructor
public MainPage() {
InitializeComponent();
}
private void GestureListener_DragDelta(object sender, DragDeltaGestureEventArgs e) {
transform.X += e.HorizontalChange;
transform.Y += e.VerticalChange;
}
GestureType prevGestureType;
private void disableGestures(object sender, ManipulationStartedEventArgs e) {
prevGestureType = TouchPanel.EnabledGestures;
TouchPanel.EnabledGestures = GestureType.None;
fixedSlider.IsHitTestVisible = false;
}
private void restoreGestures(object sender, ManipulationCompletedEventArgs e) {
TouchPanel.EnabledGestures = prevGestureType;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment