?
Solved

WPF WebBrowser

Posted on 2016-10-14
6
Medium Priority
?
41 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 41846403
Read my comment again.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

765 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