我有一个工作良好的WebView
控件,但是当试图将doubletapping事件附加到控件时,当我在模拟器中物理地继续双击web内容时,它似乎不起作用。有什么需要做的吗?
:
<Grid x:Name="LayoutRoot" DataContext="{StaticResource FeedEntryModel}">
<WebView x:Name="feedEntry" IsHitTestVisible="True" DefaultBackgroundColor="WhiteSmoke" DoubleTapped="feedEntry_DoubleTapped" IsDoubleTapEnabled="True" IsTapEnabled="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsHoldingEnabled="True" />
</Grid>
事件处理程序
private void feedEntry_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
feedEntry.Navigate(new Uri("http://www.google.com"));
}
任何想法?
window.document.ondblclick = function() {
window.external.notify("dblclick");
}
private void OnScriptNotify(object sender, NotifyEventArgs e)
{
if (e.Value == "dblclick")
{
}
}
这是因为WebView内容选择双击。不如这样试试:
<Grid x:Name="LayoutRoot">
<WebView x:Name="feedEntry" Source="http://igrali.com" IsHitTestVisible="True" DefaultBackgroundColor="WhiteSmoke" IsDoubleTapEnabled="True" IsTapEnabled="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsHoldingEnabled="True" />
<Grid DoubleTapped="feedEntry_DoubleTapped"
Background="Transparent"/>
</Grid>