I have a WebBrowser object in a WPF Page and I\'m trying to do something whenever the user interacts with the page. I have intially tried to use the events associated with t
Mouse events are not supported by the WebBrowser
control, according to the documentation. You need to hook up handlers to the DOM events provided by the document being displayed in the control, using the WebBrowser.Document
property. This post has an example of how to do this.
Add the ms html com library
Once the WebBrowser.LoadCompleted event fires try this:
mshtml.HTMLDocumentEvents2_Event doc = ((mshtml.HTMLDocumentEvents2_Event)Browser.Document);
doc.onmouseover += new mshtml.HTMLDocumentEvents2_onmouseoverEventHandler(doc_onmouseover);
or use some other event.
Hope this helps someone.