c# - hide webBrowser scrollbar wpf -
i have webbrowser , loading .html file. problem although have set scrollviewer.verticalscrollbarvisibility to"hidden", scrollbar still visible.
i have tried approach , not working
<webbrowser x:name="personalizedwebbrowser" horizontalalignment="left" verticalalignment="top" scrollviewer.cancontentscroll="false" scrollviewer.horizontalscrollbarvisibility="hidden" scrollviewer.verticalscrollbarvisibility="hidden" loadcompleted="wb_loadcompleted"/> private void wb_loadcompleted(object sender, system.windows.navigation.navigationeventargs e) { mshtml.ihtmldocument2 dom = (mshtml.ihtmldocument2)personalizedwebbrowser.document; dom.body.style.overflow = "hidden"; }
could please suggest else?
i solved problem using windows forms webbrowser control in wpf project:
private void window_loaded(object sender, routedeventargs e) { string curdir = system.io.path.getdirectoryname(system.reflection.assembly.getexecutingassembly().location) + "\\help"; system.windows.forms.integration.windowsformshost host = new system.windows.forms.integration.windowsformshost(); system.windows.forms.webbrowser webbrowser1 = new system.windows.forms.webbrowser(); host.child = webbrowser1; webbrowser1.documentcompleted += webbrowser1_documentcompleted; string sfilename = "file:///{0}/index.html"; webbrowser1.url = new uri(string.format(sfilename, curdir)); webbrowser1.scrollbarsenabled = false; this.grid1.children.add(host); } private void webbrowser1_documentcompleted(object sender, system.windows.forms.webbrowserdocumentcompletedeventargs e) { system.windows.forms.webbrowser webbrowser1 = sender system.windows.forms.webbrowser; if(webbrowser1==null)return; webbrowser1.document.body.style = "overflow:hidden"; }
grid1 used container webbrowser1
we need add in project following assembly references: windowsformsintegration, system.windows.forms
Comments
Post a Comment