The following problem is not simple to explain. I have a Window which contains a DataGrid, and a ViewModel for the window. The window.DataContext holds the ViewModel. the DataGrid.ItemSource holds an ObservableCollection. DataGrid's RowStyle's IsSelected Property is Binded to an IsSelected property in the PointData.
When I close the window and open a new one... and populate it with the old ViewModel data. Selecting an "old" row throws an annoying Exception which says: "Collection was modified; enumeration operation may not execute"
If anyone has an idea of solving this开发者_JS百科 situation I would truely appreaciate the help. Thanks
Normally this exception occurs when you modify a collection while using IEnumerable (an Enumerator) to loop through the collection. The keyword foreach
uses this interface.
精彩评论