Open ranaprathap2 opened 3 years ago
You can download and run the above project,
1) Open WebView2SamplApp.sln solution file. 2) Click Preview HTML button
The Test.html page would automatically load into the WebView2 preview and you can see the content being clipped at the bottom after disabling the vertical scroll and resizing the webview2 to it's actually rendered content's height.
Hey @ranaprathap2 - Looking at your sample app (thanks for providing!) my guess is that the content is continuing to load past your 2 second delay. I would play around with setting the height on a delayed loop to see if it eventually sets the right height. Additionally, I still see the web scrollbar, which could be due to my screen's DPI and how you are getting the height of the content.
Is there a reason you don't want to use the web scrolling?
Another option would be to try disabling the vertical scrollbar using HTML/JS and executing script: https://www.geeksforgeeks.org/how-to-disable-scrolling-temporarily-using-javascript/
Hi @champnic (thanks for your reply), We have already tried disabling webview scrolling in style using overflow: hidden, still the clipping issue would occur. Also, I can get the height of the webview's content by passing document.body.scrollHeight.toString()"to ExecuteScript async method.
We have planned to construct a list view where each list view item would have a webview, So in this case disabling the webview scrolling, resetting webview's height to its content and letting the parent list view's scroll viewer to control scrolling would be a better UX(User experience) here in our case.
Hi Guys, Any update on this ?
Hey @ranaprathap2 - no update here, we haven't had a chance to look into this one closely yet.
I want to disable the WebView2's vertical scrolling and to keep the parent element scrolling instead. So I tried to resize the webview2's height to the height of its actually rendered content.
What I observed is the Webview2's height is getting set properly to its contents height, But despite still the height being set properly the content inside the webview2 is not getting rendered fully, Instead only the partial content at the top is shown.
AB#41783474