views:

405

answers:

1

In Windows Forms Applications Im using the following Code to scroll the Page inside a Webbrowser:

 HtmlDocument doc = webBrowser.Document;
 mshtml.IHTMLDocument2 htmldoc = (mshtml.IHTMLDocument2)doc.DomDocument;
 htmldoc.parentWindow.scrollBy(265, 20);

Does anyone know how to do the same in an WPF Application (without using WindowsFormsHost)?

+1  A: 

If you're using System.Windows.Controls.WebBrowser class take a look at the Document property. You should be able to cast it to mshtml.HTMLDocument or mshtml.IHTMLDocument2 and code

mshtml.HTMLDocument htmlDoc = webBrowser.Document as mshtml.HTMLDocument;
if (htmlDoc != null) htmlDoc.parentWindow.scrollBy(265, 20);

should be working fine for you.

hope this helps, regards

serge_gubenko
Works like a charm! Thank you!
MemphiZ