我试图禁用位于ScrollViewer内部的WebView的滚动事件,该事件已成功完成。
private async void webview_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args) {
// set the webview height and disable he scrolling
sender.Height = int.Parse(await sender.InvokeScriptAsync("eval", new[] { "document.body.scrollHeight.toString()" }));
await sender.InvokeScriptAsync("eval", new string[] { "document.body.style.overflow = 'hidden';" });
...
}
现在,表面上出现的问题是,当在真实设备中滚动视图时,似乎WebView的触摸事件会覆盖ScrollViewer的触摸事件。 期望的结果是保持WebView的触摸事件处于活动状态,因为它包含可点击的链接,但此外ScrollViewer的滚动事件会覆盖任何其他滚动事件。
<ScrollViewer x:Name="scrollViewer"
Height="auto">
<StackPanel Height="auto" Orientation="Vertical">
<Image x:Name="eventImage"
Height="180"
Margin="30,30,30,30"
HorizontalAlignment="Center"
VerticalAlignment="Top" />
<TextBlock x:Name="eventDate"
HorizontalAlignment="Center"
ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled"
TextWrapping="Wrap" />
<WebView x:Name="webview"
Margin="0,0,0,0"
NavigationCompleted="webview_NavigationCompleted"
ScrollViewer.ZoomMode="Disabled" />
<ListView Name="m_ListView"
MinWidth="300"
MinHeight="200"
Margin="0,0,0,80"
HorizontalAlignment="Center"
VerticalAlignment="Bottom" />
</StackPanel>
</ScrollViewer>
提前致谢。等待任何回应。