This project has moved. For the latest updates, please go here.

BusyIndicator and focus

Jun 28, 2011 at 7:59 AM

Hi

In my application if a TextBox has focus when the BusyIndicator is shown, it will have lost the focus when the BusyIndicator is hidden again

Is there a way to prevent this? or am I using the BusyIndicator wrong?

Jun 28, 2011 at 2:27 PM

Don't worry you are not doing anything wrong.  This is the expected behavior when using the busyindicator.

Jun 28, 2011 at 2:30 PM

Hmm, why is that expected? I think the logical think would be that when the app is no longer visible, that it would restore focus

Jun 28, 2011 at 2:35 PM

The BusyInciator does not hide the app so the app is visible.  The BusyIndicator is a content control.  When the BusyIndicator shows it overlays the content defined within it and it (.NET Framework) automatically removes focus from the underlying controls.

Jun 28, 2011 at 2:43 PM

OK, I should be more careful and check my writing before posting. I'll try to rephrase it.

If a control inside the busy indicator has focus before the busy indicator is shown. I would expect the control to have focus when the busy indicator is hidden again. Especially when I use busy indicator on the whole window, so there is nowhere else I can set the focus.

Jun 28, 2011 at 2:51 PM

I do agree with your scenario, but I am limited by the .NET framework.  What happens is when the BusyIndicator is shown, focus is given to the busy indicator by the .NET framework.  As you know, when the BusyIndicator is hidden again, it looses the focus but now your previous control no longer has focus.  Dealing with focus in WPF has always been a pain point for developers.  Sorry I couldn't provide a solution for you.  Maybe an option would be to manually set focus when the "IsBusy" property of your underlying data source changes.

Jun 29, 2011 at 7:08 AM

OK, thank you for the support. I'll try handling it manually

Mar 5, 2012 at 8:24 AM

Hi, I know this is an old post. But Telerik RadBusyIndicator does provide a workaround,

http://www.telerik.com/help/silverlight/radbusyindicator-how-to-restore-the-focus.html

So the BusyIndicator in Extended WPF Toolkit may achieve the same behavior.

Regards,

Lex

 

Mar 5, 2012 at 1:50 PM

The Extended BusyIndicator must have that property "IsBusyIndicationVisible" as mentioned by "lextm".

Handling manually does not work. This behavior sucks, because in my scenario I have a control called Filter, and it has a child control TextBox. This Filter filters the database (then calling IsBusy=true) whenever the user inputs text, so every time the control loses focus and the user has to click on it.