Focus of PopupContent in PopupButton

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 12 years ago by Dariusz Wasacz
Version: 11.2.0552
Avatar
When I press PopupButton and it opens its PopupContent, the PopupContent isn't focused - it doesn't respond neither for mouse movements (hovering) nor for keyboard inputs (i.e. arrows for cursor movements, Esc key for closing the popup). You may notice it also in your demo application ("PopupButton features").

How can I fix it?

Comments (5)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Dariusz,

I tried our PopupButton Features Demo and it appears to be working fine. If you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 12 years ago by Dariusz Wasacz
Avatar

I sent the attachment to the support address, because I don't know how to attach it in the forum.

In the attachment I enclose a sample project which shows a PopupButton which popups a ListBox, and a reference ListBox. The reference listbox becomes focused on application startup. It responds to keyboard inputs (arrow up, arrow down).

When I open the popup, the popup listbox is inactive. The keyboard events are still handled by the reference listbox - not by the popup listbox. Also the popup listbox doesn't respond to Esc key, which is supposed to close the popup. When I click the popup listbox it receives the focus and starts handling keyboard inputs (arrows, Esc).

I expected the popup listbox responded to keyboard inputs just after it is shown.

The popup listbox hovers on mouse movements (contrary to that I wrote in the previous post). I found that it does when I enable themes for application. It is fine for me.

[Modified 12 years ago]

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Dariusz,

I see what you mean. If you don't explicitly click in the content, it is not automatically focused when the popup is opened. We've added a new IsAutoFocusOnOpenEnabled option on the PopupButton that will focus the content when the popup is opened for the next maintenance release.

In the interim, you would have to manually focus the ListBox, possibily using the IsVisibleChanged event:

private void ListBox_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
	var control = sender as ListBox;
	if (control != null && control.IsVisible)
		control.Focus();
}


Actipro Software Support

Posted 12 years ago by Dariusz Wasacz
Avatar

Thank you for the answer. I'll check it in the maintenance release.

Posted 12 years ago by Jim Foye
Avatar

I found I needed this property today. Works great!

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.