Windows 8 地铁应用程序中的Scrollviewer-通过触摸滚动并处理其他手势

Windows 8 地铁应用程序中的Scrollviewer-通过触摸滚动并处理其他手势,windows-8,microsoft-metro,scrollviewer,gestures,Windows 8,Microsoft Metro,Scrollviewer,Gestures,我有一个带有网格和Scrollviewer的页面: <Grid x:name="mainGrid"> ... <ScrollViewer Name="mainScroller" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollMode="Enabled"> ... </ScrollViewer> ... </Grid

我有一个带有网格和Scrollviewer的页面:

<Grid x:name="mainGrid">
  ...
  <ScrollViewer Name="mainScroller" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollMode="Enabled">
    ...
  </ScrollViewer>
  ...
</Grid>

...
...
...
我想为垂直触摸移动(用手指向上移动)做手势处理,但我也想通过水平触摸移动保留滚动主滚动条内容

我尝试为mainGrid操纵Completed=“Grid\u操纵已完成”添加:

private void Grid\u操作已完成(对象发送方,操作已完成RoutedEventargs e)
{

如果(e.Cumulative.Translation.Y<-50&&e.velocies.Linear.Y,这可能有助于理解您的场景,但一般来说,您不应该像您建议的那样创建可能与内置手势冲突的新手势

约翰·威斯
微软-高级技术传道者
jwiese@microsoft.com

@johnwiese

为什么不将操纵模式设置为“全部”…我尝试过,但都是一样的。如果我只在mainGrid上添加操纵模式,我可以滚动,但操纵事件只能在scrollViewer外引发。如果我在mainScroller或其子元素上添加操纵模式,则我无法滚动。
private void Grid_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
  if (e.Cumulative.Translation.Y < -50 && e.Velocities.Linear.Y<1000)
  {
    ...make some action...
  }
}