I have a Silverlight 2 Beta 2 application with a DataGrid. When I set the DataGrid's DataContext or ItemSource property (in code) to and empty ObservableCollection and then add items to the collection everything works fine. However, if I set the either DataContext or ItemSource to a prepopulated List or ObservableCollection the site crashes with an unattached Debugger window reporting an exception:
System.ArgumentException: Value does not fall within the expected range.
In my application I need to be able to assign a list or collection that is already populated. It would be a big mess of the code to create a new collection for every DataGrid that might be bound to the same data and then handle all the data changes between them.
I have some simplified code below that I used for testing the problem. I had to type the code out for this post instead of pasting. So, if you find any spelling error and wonder h ...
Go to the complete details ...