Is there a way to figure out which control in my visualtree has focus? This is mostly for debugging.
Asked
Active
Viewed 6,578 times
8
-
2every control has a property HasFocus. You might use it in some way to figure your requirements – Pankaj Upadhyay Nov 10 '11 at 09:43
1 Answers
23

Sai Kalyan Kumar Akshinthala
- 11,704
- 8
- 43
- 67
-
The namespace is System.Windows.Input and is part of the PresentationCore.dll assembly. – crunchy Jun 06 '14 at 15:55
-
as described here [link](https://learn.microsoft.com/en-us/dotnet/api/system.windows.input.focusmanager.getfocusedelement?view=windowsdesktop-7.0#system-windows-input-focusmanager-getfocusedelement(system-windows-dependencyobject)) `FocusManager.GetFocusedElement()` requires the focus-scope as parameter. I used `FocusManager.GetFocusedElement(this)` – Tom667 Aug 25 '23 at 06:40