Does anyone have a good way to debug WPF focus?

I am going to focus on hell right now in my WPF application. The focus jumps between the elements and, apparently, disappears only in order to appear on another element when the tab key is pressed again.

Is there a property with which I can associate a shortcut, or something that just tells me that the keyboard clicked at that moment? Sometimes I see a chain of ant (dashed line) indicating that something has focus, but I can’t say what it means to turn off the keyboard focus!

+5
source share
4 answers

What are you most likely looking for:

(System.Windows.Input.Keyboard.FocusedElement as FrameworkElement) .Name

DependencyProperty , , .

Vaccano

+2

, , , .

  • spy ++, Visual Studio, , ; .
  • (, ). . , .

, ? ? , (.. (), ) .

0

Perhaps you could try setting the correct values ​​to the TabIndex property of the controls? This should make the focus "jump" along the "path" that you want it to hop when you press Tab.

0
source

I highly recommend reading this article. It comes with some source code that can help debug focus problems, I often end up using this code to help solve my own problems.

http://julmar.com/blog/mark/?p=52

0
source

All Articles