0

I'm having an issue with the WPF WebBrowser control. It seems to have the logical focus (at least, when I press a key, my keyUp/keyDown events are fired), but the caret is not displayed on the control.

In fact, although the keyUp events are fired, nothing is written in the webbrowser since the caret is not displayed.

Focusable property is set to True not only on the Usercontrol, but also on the WebBrowser control until I click on the box.

I tried setting the focus on the webBrowser:

this.webBrowser.Focus();
Keyboard.Focus(this.webBrowser);

But also on the mshtml element (webBrowser.Document)

this.webBrowser.Document.Focus();

The property Keyboard.FocusedElement returns webBrowser.

This post sounds very similar to my problem, and the solutions posted there are not working in my case. I'm not sure if there's any solution: WebBrowser control keyboard and focus behavior

Any hint? Thanks in advance.

Community
  • 1
  • 1
Borja López
  • 2,303
  • 2
  • 14
  • 16
  • In addition to that, when moving to another app by using Alt+Tab and then coming back to my app, the caret appears! – Borja López Nov 17 '15 at 09:39
  • I used `this.webBrowser1.Navigate("http://google.com");` and the caret is visible. It's better to share a code to simply reproduce the problem. – Reza Aghaei Nov 17 '15 at 10:04

0 Answers0