views:

15

answers:

1

Hi,

I have a ListBox control with an ObservableCollection instance as the control's ItemsSource property.

Everything works fine, but when I handle the control's OnSelectionChanged, my business logic modifies the collection's data and I no longer get the ListBoxItem background change you usually get when your ListBox selection changes.

Did anyone encounter the same problem ? Any solution here ?

Thanks and best regards,

Romain

+1  A: 

It sounds like you are losing your selected item reference when the list changes.

Bind your ListBox's SelectedItem to a property on your data context and handle selection changes there.

benPearce
Didn't work for me. I have now a data binding between ListBox.SelectedItem and my data context but the result is the same :-(
optimum