WPF Popup focus nightmares

We have a fairly advanced windowing system for the app I’m developing, and one of the side effects is that when using controls inside a Popup control, the keyboard focus does not always behave correctly for the controls inside the popup.

I found this great article which immediately solved my problem : http://www.hardcodet.net/2009/09/activating-wpf-popups-ensures-controls-are-enabled

The root cause of my issue is that a Popup’s HWND has the WS_EX_NOACTIVATE flag set, meaning that the focus is not set properly.

Credit to Philipp Sumi and Andrew Smith.



Leave a comment

Filed under UI Hints, Useful, UX, WPF

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s