DoubleTapped事件无法在WebView上运行

时间:2014-05-31 22:54:33

标签: c# xaml webview event-handling windows-phone-8.1

我有一个WebView控件可以正常工作,但是当我尝试将DoubleTapped事件附加到控件上时,它似乎无法工作,当我身体前进并双击网页上的内容时模拟器。有什么需要做的吗?

我的XAML:

<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"));
}

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

这是因为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>

答案 1 :(得分:1)

window.document.ondblclick = function() {
    window.external.notify("dblclick");
}

private void OnScriptNotify(object sender, NotifyEventArgs e)
{
    if (e.Value == "dblclick")
    {
    }
}