通过 Windows Phone 8 的 GestureService 实现轻弹手势 [英] Implement Flick Gesture via GestureService from Windows Phone 8
问题描述
我正在开发 Windows Phone 8 应用.此应用程序将允许用户向上轻弹面板.我希望这与锁定屏幕的工作方式非常相似.当用户轻弹"面板时,我希望它自动向上移动.有谁知道如何做到这一点?目前,我有以下几点:
I'm working on a Windows Phone 8 app. This app will allow a user to flick a panel up. I want this to work very similarly to the way the lock screen works. When the user 'flicks' the panel up, I want it to automatically, move up accordingly. Does anyone know how to do this? Currently, I have the following:
<Grid x:Name="myGrid" Background="Peru" VerticalAlignment="Stretch">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener x:Name="myGridGestureListener" DragStarted="myGridGestureListener_DragStarted" DragDelta="myGridGestureListener_DragDelta" DragCompleted="myGridGestureListener_DragCompleted" Flick="myGridGestureListener_Flick" />
</toolkit:GestureService.GestureListener>
<Grid.RenderTransform>
<TranslateTransform x:Name="bannerGridTransform" Y="5000" />
</Grid.RenderTransform>
</Grid>
private void myGridGestureListener_Flick(object sender, FlickGestureEventArgs e)
{
if (e.Direction == System.Windows.Controls.Orientation.Vertical)
{
}
}
就我的一生而言,我无法弄清楚如何让 myGrid 相应地对轻弹手势做出平滑的反应.我认为有人已经实现了这一点,但是,显然,我错了.
For the life of me, I can't figure out how to get myGrid to smoothly react to the flick gesture accordingly. I figured someone would have already implemented this, however, apparently, I'm wrong.
谢谢!
推荐答案
如果有人需要在 Windows Phone 8 中实现手势 - 看看这个 https://github.com/PedroLamas/WPtoolkit/blob/master/PhoneToolkitSample8/Samples/GestureSample.xaml.cs
If someone need to implement gestures in Windows Phone 8 - look at this https://github.com/PedroLamas/WPtoolkit/blob/master/PhoneToolkitSample8/Samples/GestureSample.xaml.cs
这篇关于通过 Windows Phone 8 的 GestureService 实现轻弹手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!