How to find out which element has focus when debugging WPF?
Asked Answered
P

1

5

I'm navigating with the keyboard, and I can't find visually which element has the focus. While debugging I managed to break the execution in a method inside the Window but I don't know which property will reveal the current focused control.

Policlinic answered 6/7, 2011 at 16:51 Comment(0)
F
13

Use Snoop and look for the events in events tab. Select all the events you want to listen from the events combo box. As you move through your application you can see the tab refreshing with new controls that are receiving those events.

Fleabitten answered 6/7, 2011 at 16:54 Comment(3)
I didn't need to look for events. In the footer it showed the current focused element.Policlinic
I meant GotKeyboardFocus eventFleabitten
No need for that. It reads the Keyboard.FocusedElement property.Policlinic

© 2022 - 2024 — McMap. All rights reserved.