Solved

WPF WebBrowser

Posted on 2016-10-14
6
26 Views
Last Modified: 2016-10-22
I am using the code below to hide the scroll bars on the WebBrowser control and it does not seem to be working as I might expect.

<WebBrowser x:Name="webPage" ScrollViewer.CanContentScroll="False" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"/>

Open in new window


Can someone point out what I may be missing here?
0
Comment
Question by:Alyanto
  • 3
  • 3
6 Comments
 
LVL 22

Expert Comment

by:ambience
ID: 41845137
WPF webbrwoser is not really WPF but the activeX webbrowser and therefore this is not going to work. Even if you put it inside a scrollviewer its probably not going to work (speculating here). One thing you can do is to execute a JS script to hide the scrollbars in the ONLoadcompleted event. There are several examples on net for doing this.
0
 
LVL 1

Author Comment

by:Alyanto
ID: 41846353
WebBrowser is a listed control for WPF as to its source, I can't comment.  However it is the suppression of scroll bars I seek not their addition.  I hope that clarifies what I am looking to do.
0
 
LVL 22

Assisted Solution

by:ambience
ambience earned 500 total points
ID: 41846403
Read my comment again.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Accepted Solution

by:
Alyanto earned 0 total points
ID: 41846464
After some cobbling together of code from several sources it seem the issue is not with the control ion terms of control scrollbars.  The issue is that some web pages have scroll bars and they are not in the control of the hosting control.

I Added this library Microsoft.mshtml and this code.

        private void webPage_LoadCompleted(object sender, NavigationEventArgs e)
        {
            mshtml.IHTMLDocument2 documentText = (IHTMLDocument2)webPage.Document; 
            documentText.body.parentElement.style.overflow = "hidden"; 
        }

Open in new window


I have solved the problem here.  The test site I used was http://www.bbc.co.uk/news but any similar will be fine.
0
 
LVL 22

Expert Comment

by:ambience
ID: 41847045
Oh man this is exactly what I was referring to "execute code in loadCompleted to turn off scrollbars." I'm glad you found the exact code.
0
 
LVL 1

Author Closing Comment

by:Alyanto
ID: 41855092
Whilst the proposed answer was not entirely appropriate in technology use it did enable me to re-examine the problem from a different angle.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question