locked
simulate user event for control?

    Question

  • Is there a way to simulate (create and send) a user interaction event (such as tap) to a control?

    The reason I am asking this is because I have encountered a lot of problems with event handling with webview. I have tried to handle it from javascript and notify native code. But still there is problem such as it's very hard to detect swipe without disabling zoom.

    Because of these problems, I want to place and control on top of webview and get the event and pass event on.

    So it is a two phase question:

    1. how to put control on top of webview which can take event before it goes to webview.

    2. how to pass on that event to webview (or create and send a event).

    If you have some idea, please let me know too.

    Thanks,

    Helin

    Wednesday, November 28, 2012 10:12 PM

Answers

All replies

  • Hi,

    The WebView control has large Z- order, we cannot put a control over it.
    General, we can use webview brush instead of WebView control.

    If you want to send a event like click, you can try to inject JavaScript code to simulate a click event.

    For more information, please check this blog
    http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx
     
    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Jesse Jiang Friday, December 07, 2012 7:18 AM
    Tuesday, December 04, 2012 9:32 AM
  • Hi Jesse,

    Thanks for your reply! I am aware of injecting js.

    Here are some problems:

    a) if the page navigated away, say click a link, injected js is simply not there anymore (is there a way to inject again to navigated page?)

    b) can you look at this post by me: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/812de139-49ba-443f-8fc3-5366c6cac778 it's another problem.

    Thank you Jesse!

    Regards,

    Helin

    Tuesday, December 04, 2012 7:24 PM
  • Hi,

     

    I think yes, you can inject whole JS function into WebView control after navigated a new page.

     

    Another question is talking about HTML5/JS, I will invoke  experts to investigate it.

     

    I closed this case, thanks for your understanding.

     

    Best regards,

    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 07, 2012 7:18 AM