DevelopThis
DevelopThis

Reputation:

Scroll to a postion in a Web Browser using Wpf

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?

Upvotes: 1

Views: 1927

Answers (2)

Kyle Delaney
Kyle Delaney

Reputation: 12264

How about this?

if (wb.Document is mshtml.HTMLDocument htmlDoc)
{
    htmlDoc.parentWindow.scrollTo(0, 0);
}

Upvotes: 0

DevelopThis
DevelopThis

Reputation:

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.

Upvotes: 1

Related Questions