detecting hold event in webview on windows phone 8.1

丶灬走出姿态 提交于 2019-12-08 11:19:04

问题


I'm currently working on a web browser app mainly targeting win rt in Windows phone 8.1. I'm now trying to figure out how to detect the hold event when a user holds down a link or image in webview and display a context menu.

How would I go about doing this? How would I detect the event in wp8.1? I know I'll have to invoke script but what is the c# to detect the event? Thanks :)


回答1:


Did you try using the Holding event attribute of the UI element?

http://msdn.microsoft.com/en-US/library/windows/apps/windows.ui.xaml.uielement.holding

Hope it helps!




回答2:


You should invoke script in WebView for binding gesture event in javascript first. Read this:MSGestureHold | onmsgesturehold event

Then you should use window.external.notify in the MSGestureHold event handler above to notify your WebView that Hold event is triggered.

But WinRT 8.1 WebView is disabled scriptnotify in non-certificated websites(read the remarks), so you should find a solution to fix this issue. Here is my solution.

Or you can download my demo directly.



来源:https://stackoverflow.com/questions/25248097/detecting-hold-event-in-webview-on-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!