问题
I cannot seem to programmatcally scroll in WPF in a normal Windows Form I would use the code below but that property does not exist in WPF.
HtmlDocument doc = this.webBrowser1.Document;
doc.Body.ScrollTop = 800;
return;
Is there an alternative to doing this?
回答1:
Not exaclty sure what to look for in that code, but I basically have a WebControl that shows a Webpage that has several articles. I would like to jump to an article by it's title. I know I can get the index of the article name, but jumping to it is the issue.
回答2:
How about this?
if (wb.Document is mshtml.HTMLDocument htmlDoc)
{
htmlDoc.parentWindow.scrollTo(0, 0);
}
来源:https://stackoverflow.com/questions/238792/scroll-to-a-postion-in-a-web-browser-using-wpf