title: WP7 TouchPanel Gesture Handling
body: <p>I got a Problem with the Gesturehandling.</p>
  
  <p>I mostly did it after this Tutorial:</p>
  
  <p><a href="http://www.nickharris.net/2010/11/using-touchpanel-for-gestures-in-windows-phone-7/" rel="nofollow">http://www.nickharris.net/2010/11/using-touchpanel-for-gestures-in-windows-phone-7/</a></p>
  
  <p>This is my Remote.xaml file:</p>
  
  <pre><code> &lt;UserControl x:Class="EnergyRadio.Remote"
   ....
   ManipulationCompleted="StackPanel_ManipulationCompleted"&gt;
        &lt;Grid x:Name="LayoutRoot" Background="Transparent" &gt;
        &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>And this is Remote.xaml.cs:</p>
  
  <pre><code> public Remote()
      {
          InitializeComponent();
          TouchPanel.EnabledGestures = GestureType.VerticalDrag | GestureType.HorizontalDrag;
      }
  
      private void StackPanel_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
      {
          //Check if touch Gesture is available  
          if (TouchPanel.IsGestureAvailable)
          {
              // Read the gesture so that you can handle the gesture type  
              GestureSample gesture = TouchPanel.ReadGesture();
              switch (gesture.GestureType)
              {
                  case GestureType.VerticalDrag:
                      MessageBox.Show("vertikal");
                      break;
                  case GestureType.HorizontalDrag:
                      MessageBox.Show("horizontal");
                      break;
                  default:
                      //do something  
                      break;
              }
          }
      }
  </code></pre>
  
  <p>It doesn't matter how i swipe my finger over the Phone it gives me back horizontal. But this should have been the first step ayway. What i actually need are four directions... that means up, down, right and left.</p>
  
  <p>But i cant find this gesturtypes.. so does anybody has an idea?</p>
  
  <p>it should look like this:</p>
  
  <pre><code>            switch (gesture.GestureType)
              {
                  case "GesturType.Up":
                      MessageBox.Show("Volume Up");
                      break;
                  case "GesturType.Down":
                      MessageBox.Show("Volume Down");
                      break;
                  case "GesturType.Right":
                      MessageBox.Show("Next Channel");
                      break;
                  case "GesturType.Left":
                      MessageBox.Show("Previous Channel");
                      break;
                  default:
                      //do something  
                      break;
              }
  </code></pre>
  
  <p>Thanks.</p>