C# WPF ListBox - losing and getting focus when changing selection

685 Views Asked by At

I have a problem which I really can't solve at all.

When my listbox is focus and I change my selection, then the "selection changed" function gets called, I am ok with that. But the "lostfocus" and "gotfocus" functions get called too. How can I prevent that? When I change my selection I only want the "selection changed" function to be called.

xaml:

<ListBox ... GotFocus="lbMemberships_GotFocus" LostFocus="lbMemberships_LostFocus" SelectionChanged="lbMemberships_SelectionChanged"/>
0

There are 0 best solutions below