Created
May 27, 2012 07:01
-
-
Save mecab/2802529 to your computer and use it in GitHub Desktop.
Sample code of fixing strange slider behivor with GestureService (code-behind)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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