如何在Windows Phone 7中滑动

我想在Windows Phone 7中刷图像。我从哪里开始?

您可以在Silverlight Control Toolkit for Windows Phone 7中使用GestureService 。 在您的UI元素中,添加以下代码片段(在WP7项目中引用工具包的DLL之后) –

    

在代码隐藏文件中实现处理程序OnFlick,就像这样 –

 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(); } } } 

希望这有帮助,indyfromoz

如果您不想使用silverlight工具包,可以使用XNA框架。

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

试试这个:

 using Microsoft.Phone.Controls; public partial class MyControl { public MyControl() { InitializeComponent(); var gl = GestureService.GetGestureListener(asd); gl.Flick += new EventHandler(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 } } } }