I have a Silverlight application where a DataForm
binds on a PagedCollectionView
containing objects that implement IEditableObject
. Whenever the user edits an object using the DataForm, the CollectionChanged
event on the collection fires twice, first with a Remove action, then with an Add action.
This is not what I want. I simply want to edit the object in the collection without firing the CollectionChanged event.
When I try to reproduce this issue in a simple test application, it behaves as I would like (i.e. not firing the event), and I cannot figure out what causes the difference in behavior between my main application and the test application.
Does anyone know when the DataForm decides to change the collection, rather than simply editing the object? What causes this difference?
Update
These articles got me thinking about Filters and as it turns out, having a Filter applied to the PagedCollectionView makes the difference. With filter: an edit action by the user results in Remove/Add from the collection, without filter: no collection change, just editing the object.
So now the question is: why does the filter cause the Remove/Add behavior (even if the filter just 'returns true', i.e. allow all entries in the collection) and how to prevent this?