Solved

WPF WebBrowser

Posted on 2016-10-14
6
20 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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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
 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now