Parthasarthi B.K
Parthasarthi B.K

Reputation: 45

Lostfocus actingas gotfocus for combobox in wpf

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

Answers (1)

Nawed Nabi Zada
Nawed Nabi Zada

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

Related Questions