I have a search screen in my WPF application. The screen is implemented as a UserControl in a TabItem TabControl. When the user switches to the Search tab, I want the focus to move to one specific field.
So, I added the Loaded event handler to the UserControl tag in Xaml, and I called the Focus method for the control that I want to have initial focus in the Loaded event handler. This worked fine until I updated the Telerik management library that I use today. Now, when I switch to the Search tab, the focus is NOT in the field that I want to have, but I canβt tell which control has focus.
The field I want to focus on already has GotFocus and LostFocus event handlers for other reasons. I remembered that in Win Forms, the arguments to the LostFocus event handler suggest which control will receive the focus. So I set a breakpoint in the LostFocus handler and found that the arguments to the LostFocus event handler in WPF do not include this information.
How can I determine where the focus goes without putting GotFocus handlers on each control in UserControl?
Tony
source share