I have source elements like this:
var collection = new ObservableCollection<SourceItems>(source);
source implements INotifyPropertyChanged
I need to edit and view this collection in CheckListBoxes (listBox with checkBoxes from WPFToolKit)with rules:
Every CheckListBox has itemsSource
checkListBox1.ItemsSource=collection;
So, if i check items in one listBox i must see only checked items in other. And every listBox must be sorted by one of source's field
listBox1 by field orderItem
listBox2 by field orderVisibleItem and so on.
User can move elements in each listBoxes and it must not affect ordering in other.
I tried create CollectionViewSource for every ListBox. But when I sort one, it sort each other.
Linq for filtering and sortnig don't work too, because changes not updating dynamicly.
Is there best way to create such functionality?
You should use CollectionViewSource
.
I'm guessing that you used CollectionViewSource.GetDefaultView(.. )
? you should create two NEW views for the collection:
CollectionViewSource cvs = new CollectionViewSource() { Source = TheCollection };