WP7 TextBox focus problem when WebBrowser exists
I ran into a strange issue concerning the usage of the WebBrowser control in windows phone applications. The thing is when you use WebBrowser control it "steals" the focus and prevents setting it to any other control until a user input occurs. The WebBrowser itself doesn't even have to be on the same page as the textbox.
Consider a scenario:
Create an empty application. Put a WebBrowser and a TextBox on your main page (rootvisual). Now in the page loaded event (or anywhere else) try to set the focus on the textboxtbx.Focus();
The textbox will theoretically have the fo开发者_如何学运维cus, the SIP (software keyboard) will slide up ... but the textbox will lack a cursor and you won't be able to type anything.
The same thing happens if you put the textbox on a different page and navigate to it with the appbar without touching anything else after the app starts.
The FocusManager.GetFocusedElement()
shows that our textbox indeed has the focus.
How to fix this issue? Very annoying :)
Btw. the problem exists on:
- devices running version 7.0.7004.0 (before NoDo, initial release?) - devices running NoDoThe problem does NOT exist on:
- devices running Mango - emulator (7.1 designed for Mango)Thx for any help.
This is a known problem, and as far as I know there is no way around it, although I've tried (setting focus in a timer, etc).
精彩评论