tags:

views:

211

answers:

1

Hi, I was wondering if there is a way to find out that the focus is not on the my WPF window, so I can capture the name of the window which has the focus on?

thanks,

+2  A: 

Check this out.

kek444
nice tips, but is there anyway to handle this change of focus in the window, and use this snippet later on?
paradisonoir
You could use the Window.OnLostFocus http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onlostfocus.aspx, if I understand you correctly.
kek444
the problem is LostFocus handles change of focus of controls such as textbox, and it does not work with Window itself. I want to know if a user uses ALT+TAB, and open a new window, I get the name of new window.
paradisonoir
You are right, I sould have said the Deactivated event http://msdn.microsoft.com/en-us/library/system.windows.window.deactivated.aspx
kek444
thanks that was great.
paradisonoir