Specifically, I have a button that opens a non-modal child window. Something in the main window steals the focus away from the child window as it opens.
The fully general approach is to comment out parts of code until the problem goes away. I'm looking for faster methods.
You can use the Live Visual Tree to explore the visual tree of a WPF object and view the WPF dependency properties for the objects in that tree. You can use the WPF Tree Visualizer to explore the visual tree of a WPF object and view the WPF dependency properties for the objects in that tree.
In WPF there are two main concepts that pertain to focus: keyboard focus and logical focus. Keyboard focus refers to the element that receives keyboard input and logical focus refers to the element in a focus scope that has focus.
I'm using Snoop to do this right now.
For starters, Snoop shows the current focused element and the current FocusScope in the status bar.
You can get it to show you all the GotFocus and LostFocus events:
Similarly you can track the FocusManager events the same way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With