Unplanned
Last Updated: 19 Nov 2024 11:34 by ADMIN
Martin Ivanov
Created on: 04 Oct 2024 12:34
Category: DataGrid
Type: Bug Report
1
DataGrid: IndexOutOfRangeException is thrown when updating the ItemsSource after calling its Clear method

IndexOutOfRangeException occurs in some situations when updating the ItemsSource collection of RadDataGrid. In order to reproduce the issue, the ItemsSource collection should be cleared by calling its Clear method. When you add a specific number of items after that the error occurs. The number of added items depends on the viewport's height.

To work this around, instead of calling the Clear() method of the ItemsSource collection, remove the items one by one.

var collection = (ObservableCollection<MyModel>)this.dg.ItemsSource;
 while (collection.Count > 0)
 {
     collection.RemoveAt(collection.Count - 1);
 }

 

2 comments
ADMIN
Martin Ivanov
Posted on: 19 Nov 2024 11:34

Hello Heiko,

We can't give any promises here, but since this was recently reported and it causes an exception there is good chance that it will get fixed for the next release. I suggest you to follow this item in order to get notified as soon as its status changes.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Heiko
Posted on: 13 Nov 2024 07:45
How long will it take to fix this? We have many places in our code where we would have to apply this workaround. We're paying for your product and this is an obvious bug which causes many crashes of our app. I think it shouldn't be too hard to fix, but it's not even planned yet...