jak uzyskać swipe w windows phone 7

Chcę przesuwać obrazy w windows phone 7. Od czego mam zacząć?

Author: bkaid, 2010-12-03

3 answers

Możesz użyć GestureService W Silverlight Control Toolkit dla Windows Phone 7. W elemencie UI Dodaj następujący fragment kodu (po odwołaniu się do biblioteki DLL zestawu narzędzi w projekcie WP7) -

<toolkit:GestureService.GestureListener>
    <toolkit:GestureListener Flick="OnFlick"/>
</toolkit:GestureService.GestureListener>  

Zaimplementuj obsługę onflick w pliku z kodem, jak tak -

private void OnFlick(object sender, FlickGestureEventArgs e)
{
   var vm = DataContext as SelectedCatalogViewModel;
   if (vm != null)
   {
      // User flicked towards left
      if (e.HorizontalVelocity < 0)
      {
         // Load the next image 
         LoadNextPage(null);
      }

      // User flicked towards right
      if (e.HorizontalVelocity > 0)
      {
         // Load the previous image
         LoadPreviousPage();
      }
   }
}

Mam nadzieję, że to pomoże, indyfromoz

 41
Author: indyfromoz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-04-18 09:26:23

Jeśli nie chcesz używać zestawu narzędzi silverlight, możesz użyć frameworka XNA.

Http://www.nickharris.net/2010/11/using-touchpanel-for-gestures-in-windows-phone-7/

 7
Author: Phill,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-12-03 04:52:14

Spróbuj tego:

using Microsoft.Phone.Controls;

public partial class MyControl
{
    public MyControl()
    {
        InitializeComponent();

        var gl = GestureService.GetGestureListener(asd);
        gl.Flick += new EventHandler<FlickGestureEventArgs>(GestureListener_Flick);
    }

    private void GestureListener_Flick(object sender, FlickGestureEventArgs e)
    {
        if (e.Direction == Orientation.Horizontal)
        {
            if (e.HorizontalVelocity < 0) // determine direction (Right > 0)
            {
                //Some Action
            }
            else
            {
                //Some Action
            }
        }
    }
}
 5
Author: Sorokin Andrey,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-11-19 10:50:20