Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a webpage which I need to display in my desktop application (WPF). I am using WebBrowser control. The webpage which I am populating has an IHTMLELEMENT control which has scrolling and I need to perform the smooth scrolling.

What I have tried:

I am able to get the IHTMLELEMENT control and perform scrolling using (IHTMLELEMENT).scrollIntoView(true) -> to scroll top and (IHTMLELEMENT).scrollIntoView(false) -> to scroll bottom. This perform scrolling in one shot and I want to perform scrolling smoothly and slowly.
Posted
Updated 24-Oct-19 6:08am

1 solution

There is an overload of scrollIntoView which allows you to specify smooth scrolling:
Element.scrollIntoView() - Web APIs | MDN[^]

Unfortunately, it's not supported in any version of Internet Explorer, so it won't work with the WebBrowser control.

Even the polyfill[^] only supports IE9+, so it's not going to work in the WebBrowser control, which is stuck in IE7 mode.

If possible, I'd recommend switching to a better browser control like CefSharp[^] or Geckofx[^].
 
Share this answer
 
Comments
partha143 25-Oct-19 2:25am    
Richard : Thank you for your suggestion. Can you kindly provide some more information on CefSharp on scrolling HTML Element. I googled but was unable to find any relevant info on that. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900