LOading large amount of data into SfDataGrid

Hi,

i am using a BindingList as Itemsource for a Datagrid.
In my ViewModel i have a method, which populates the grid.
The grid gets only refreshed after the loop, which fills the binding list has ended.
I have enabled Virtualization, but this is the same.

when i use a BackGroundWorker to fill the Bindinglist in the Viewmodel, i am getting a System.InvalidOperationException.
"Collection was modified; enumeration operation may not execute."

So what is the preffered method in MVVM to load data via the ViewModel for the Datagrid, so that when e.g. 1000 Items are being read the Grid is constantly beig updated, while still reading?
Or does this work as designed and i should show an animation that data is being read?

thanks,

Helmut 



1 Reply

JG Jai Ganesh S Syncfusion Team March 6, 2018 03:40 AM UTC

 
You can set the ItemsSource to SfDataGrid from viewmodel and also load the BusyIndicator while setting ItemsSource by enabling ShowBusyIndicator property like below, 
 
<Syncfusion:SfDataGrid x:Name="datagrid"   
                               AutoGenerateColumns="False"  
                               AllowEditing="True"   
                               EnableDataVirtualization="True" 
                               ShowBusyIndicator="True" 
                               ItemsSource="{Binding GDCSource}"    
                               /> 
 
 
Regards, 
Jai Ganesh S 


Loader.
Up arrow icon