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
225
Binding added data to data source
posted

I have a situation where I want to add data to a data source in chunks. Because retrieving large amounts of data will be slow, part of the data will be retrieved and bound to the grid as needed. What is the best way to rebind / update the grid when rows are added? Does any data source type behave better with the datagrid than others when the data source size is increased? (It will never shrink).

Thanks.
Greg

Parents
No Data
Reply
  • 8576
    Offline posted
    Hi Greg -
     
    As long as the data source fires list changed notifications I don't think one data source type is any better than another.  For example, if you use a data source that implements IBindingList and fires the ListChanged event, that should work just fine. 
     
    What you will probably want to do when adding data to the data source is to add the records as a group so only a single change notification will be fired for the grid. 
     
    BTW - what is the trigger that causes you to load a new batch of records?  If you are trying to add new records to your data source on a background thread, please be aware that this is not supported.  You would need to add the new records on the UI thread. 
     
    Also, since the xamDataGrid only asks the data source for records as it needs them (e.g., when the user scrolls to the next page), you might want to consider using the NetAdvantage WindowsForms control called UltraDataSource which supports virtual data loading via a callback mechanism.  In this scenario, when the XamDataGrid asks the UltraDataSource for more records, the callback is called and you can supply the requested records from your back end. 
     
    Keep in mind that in all these 'virtual' data loading scenarios, if the user causes the data to be sorted or grouped via the grid's UI, then ALL the records will have to be loaded.  You may want to disable sorting and grouping via the UI if this is an issue for your application.
     
    Joe
     
Children