Solved

WPF WebBrowser

Posted on 2016-10-14
6
23 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

948 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

18 Experts available now in Live!

Get 1:1 Help Now