views:

9

answers:

0

Hi,

I have 2 listboxs which ItemsSource is an ObservableCollection, but that throw an exception of "not valid value", for resolve that I made a wrapper class that have a property of type MyUserControl and I changed also the collection for an ObservableCollection changing also the ListBoxItemTemplate to a ContentPresenter with Content binding to the property created. That worked!!

The problem is the next: I have a button and I need when click it, the element at the position i of my ObservableCollection must be the first, then in the button Click event I Remove the element at position i and inmediatly Insert the same element at position 0, but that throw an exception of "not valid value" again.

If I have only 1 listBox, that don't happen, how can I get this functionality?

thanks in advance, llucia