I have this collection:
ObservableCollection<MyData> Files;
This collection is full of objects and i put this list inside my ListView
:
ItemsSource="{Binding Files}"
Now when my application do the work vai Parallel.Foreach
(via different threads)
i want to be able to cange the order inside my ListView
.
I have try something like that:
private void MoveItem()
{
var itemToMove = lvPcapFiles.Items[3];
lvPcapFiles.Items.RemoveAt(0);
lvPcapFiles.Items.Insert(0, itemToMove);
}
And when try to use it i have this InvalidOperationException
error:
Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.