Popups in XBAP stop receiving anything but mouse events after losing focus?

烂漫一生 提交于 2020-01-17 01:18:38

问题


I have a Popup control in my XBAP, and whenever the popup control is open and it loses focus (such as an alert box, a breakpoint, switching to another application in Windows, switching to another Tab in my web browser, etc), the Popup no longer responds to anything but Mouse events.

I cannot:

  • Select a TextBox with the Mouse
  • Highlight Text in a TextBox with the Mouse
  • Use the Tab key to change controls
  • Select a ComboBox item using the Keyboard when I open it with the Mouse

I can:

  • Change a ComboBox value with the Mouse
  • Click a button with the Mouse

回答1:


Closest thing to this problem I could find was http://social.msdn.microsoft.com/Forums/en/wpf/thread/cd723315-187f-4d8b-a97d-6aac38a2ed1f

Programmer was losing focus to their popup and never able to get it back. According to a Microsoft Supporter. "it looks like you hit a known bug related to Popup in XBAP."

You can see if it's similar to your issue, but the problem was never solved. OP ended up adding a canvas to the main page and a usercontrol to replace the popup window.


If this in fact isn't some sort of unavoidable behaviour, and I were tackling this problem from scratch, I would check when your application regains focus and see whether your application is getting both the keyboard and logical focus, and that the focus scope is correct all the way down to the controls on your popup.

In Logical focus, there is the notion of a “Focus Scope”, which is an application-defined boundary around a group of UIElements. Each Focus Scope maintains its own “Focused Element” which can be different than the element that has Keyboard focus.



来源:https://stackoverflow.com/questions/7502973/popups-in-xbap-stop-receiving-anything-but-mouse-events-after-losing-focus

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!