I’m using a WPF WebBrowser control to preview HTML typed by the user.
example…
WPF TextBox and WebBrowser controls http://img411.imageshack.us/img411/2296/appbz9.jpg
But, how do I made the WebBrowser control read-only? I don’t want the user to be clicking links in there and navigating away from the preview page.
I want my users to create links. I just want to make sure the ‘preview’ pane is a preview of the correct page.
Capture the Navigating event of the WebBrowser control and set the Cancel property of its NavigatingCancelEventArgs to True.
Visual Basic code…
This requires a global locking boolean variable.
And locking and unlocking to be wrapped around the desired navigation.
WebBrowser1Locked = False WebBrowser1.NavigateToString('...') WebBrowser1Locked = True