Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Add rows in xamGrid like AJAX style
posted

I have a data table of 60,000 records. There is a loop which validate each record and after validation add rows to another ObservableCollection object. Once all the records are processed ObservableCollection is assigned to xamGrid.ItemsSource.

This takes around 7 seconds for the grid to be visible to user.

Is it possible that I can add records to xamGrid one by one after each record validation instead of first validation all 60,000 records and then render.

I tried the approach mentioned in following link to add new record directly to xamGrid.ItemsSource

help.infragistics.com/.../xamGrid_Add_New_Row.html

I can see the records are added one by one, but new records are not rendered immediately. Records are visible only once all 60,000 records are added.

Pls advice how can I add new records one by one and same time keep on rendering the grid so that user can have better UI experience.

Parents
No Data
Reply
  • 18204
    Suggested Answer
    Offline posted

    Hello,

    Thank you for posting in our forums!

    I suspect you may still be doing the looping on the UI thread, which is why the grid is not updating until the entire data table is validated.

    If you can use .NET 4.5+ you could take advantage of the EnableCollectionSynchronization feature here.  Note that to use this, you will need to bind the XamDataGrid to the ICollectionView of your ObservableCollection.  Please see my attached sample below which demonstrates how you can accomplish this.

    7711.XDG_AsyncValidation.zip

    If this is not an option for you, the ObservableCollection must be updated on the UI thread and it would be recommended to wait until the validation is completed before displaying the grid.

    Please let me know if you have any further questions or concerns with this.

Children