Solved

WPF WebBrowser

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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