Sandeep Bansal
Sandeep Bansal

Reputation: 6394

DoubleTapped Event not working on WebView

I have a WebView control which works fine, but when trying to attach the DoubleTapped Event to the control it doesn't seem to work when I physically go ahead and Double Tap on the web content in the emulator. Is there something that needs to be done?

My 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>

The Event Handler

private void feedEntry_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
    feedEntry.Navigate(new Uri("http://www.google.com"));
}

Any ideas?

Upvotes: 2

Views: 891

Answers (2)

i-cpp
i-cpp

Reputation: 36

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

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

Upvotes: 2

Igor Ralic
Igor Ralic

Reputation: 15006

It's because WebView content picks up the double tap. How about trying something like this:

<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>

Upvotes: 1

Related Questions