Windows runtime 如何在Windows 8.1上使用鼠标滚轮禁用FlipView项目之间的滚动
我有Windows 8.1 Store C#/XAML应用程序,在这个应用程序中我有带有几个FlipView项目的FlipView。在一个项目中,我的WebView相当长。Windows runtime 如何在Windows 8.1上使用鼠标滚轮禁用FlipView项目之间的滚动,windows-runtime,windows-8.1,winrt-xaml,Windows Runtime,Windows 8.1,Winrt Xaml,我有Windows 8.1 Store C#/XAML应用程序,在这个应用程序中我有带有几个FlipView项目的FlipView。在一个项目中,我的WebView相当长。 问题-当我在WebView中使用鼠标滚轮滚动并到达页面末尾时,FlipView会滚动到下一个不需要的项目 预期的行为是在WebView中自由滚动,而不是在FlipView项目之间滚动。理想情况下,FlipView项目之间的切换应仅使用触摸或编程更改 我尝试在FlipViewItem或嵌套项上设置不同的ScrollViewer
问题-当我在WebView中使用鼠标滚轮滚动并到达页面末尾时,FlipView会滚动到下一个不需要的项目 预期的行为是在WebView中自由滚动,而不是在FlipView项目之间滚动。理想情况下,FlipView项目之间的切换应仅使用触摸或编程更改 我尝试在FlipViewItem或嵌套项上设置不同的ScrollViewer属性,改变操作模式,但到目前为止没有任何效果 示例代码:
<FlipView>
<FlipViewItem>
<Grid Background="Red"/>
</FlipViewItem>
<FlipViewItem>
<Grid>
<!-- when scrolling on this page, do not navigate to Blue or Red FlipViewItem-->
<WebView Source="http://cnn.com"/>
</Grid>
</FlipViewItem>
<FlipViewItem>
<Grid Background="Blue"/>
</FlipViewItem>
</FlipView>
在对周围所有元素尝试几乎所有ScrollViewer附加的属性后找到了它,解决方案实际上非常简单-正如所暗示的那样,我需要处理包含WebView的父元素上的PointerHeelChanged事件
<FlipView>
<FlipViewItem>
<Grid Background="Red"/>
</FlipViewItem>
<FlipViewItem>
<Grid PointerWheelChanged="PointerWheelIgnore">
<WebView Source="http://cnn.com"/>
</Grid>
</FlipViewItem>
<FlipViewItem>
<Grid Background="Blue"/>
</FlipViewItem>
</FlipView>
...
private void PointerWheelIgnore(object sender, PointerRoutedEventArgs e)
{
e.Handled = true;
}
...
私有void pointerHeelignore(对象发送方,PointerRoutedEventArgs e)
{
e、 已处理=正确;
}
为什么会这样?WebView正在转换鼠标滚轮滚动事件以移动Web内容,并将PointErrorutedEventArgs设置为已处理。但是,如果web内容已经位于底部,则WebView不会将PointerRoutedEventArgs设置为已处理,此事件随后会跳转到FlipView,在FlipViewItems之间翻转。如果我处理/停止WebView和FlipView之间的PointerHeelChanged事件,则FlipView不会在项目之间滚动。如果订阅此项,并在页面底部将其设置为已处理,该怎么办?感谢您的想法,处理指针HEELCHANGED是解决方案的关键。太棒了,现在看起来很简单:)