Reputation: 45
I'm using a combobox for which I have Lostfocus event set. But the lostfocus event is fired even when the combobox gets focus i.e gotfocus. Why is it happening so? If that is the default behavior is there any alternative solution for this?
Upvotes: 0
Views: 862
Reputation: 2875
From MSDN UIElement.LostFocus Event :
Because this event uses bubbling routing, the element that loses focus might be a child element instead of the element where the event handler is actually attached. Check the Source in the event data to determine the actual element that gained focus.
You can also use the IsFocused
property of your ComboBox
check if it has lost focus or not.
Upvotes: 1