This looks like a bug to me. If I call CancelEdit on an object with a child collection the collection is restored in reverse order from the original.
Can you suggest a fix or workaround?
It is a known behavior that deleted items restored to a collection by CancelEdit are added to the end of the collection. There's no realistic way to maintain relative positions of deleted items in the collection through a potential process of add/remove/edit changes.
As a result, the order of items in a collection is always assumed to be indeterminate. If you need a determinate order for items in the collection, you should consider using a LINQ query with ToSyncList to create a determinate view over the collection.
I hadn't thought about how the CancelEdit works so wrongly assumed the objects would revert to the extact original state. I'm using windows forms in this project so I've added a SortedBindingList to bind to the BindingSource. Now it works as I expected.
Copyright (c) Marimer LLC