Display progress when loading large amount of data

Nov 3, 2009 at 5:53 PM
Edited Nov 3, 2009 at 5:54 PM

I need to load a lot of data in the DataGrid...maybe up to 80,000 rows.  I am currently reading the .csv file using the BackgroundWorker, in order to show something spin on the UI while it reads it.  That part loads in about 6 seconds.  When it is complete, I am setting my source to the DataTable containing all the data.  It can take a full minute to load all that in the DataGrid.  How can I also get that part to be on another thread, as well as be able to update a progress bar I have on the window as well?  I'm hoping this wouldn't require something built into the DataGrid.  This would be a great topic for somebody's blog, if it can be done. :) <CollectionViewSource x:Key="AppItemData"><CollectionViewSource.GroupDescriptions><PropertyGroupDescription PropertyName="AppName"/></CollectionViewSource.GroupDescriptions></CollectionViewSource>

<tk:DataGrid AutoGenerateColumns="False" Name="dgMain" CanUserSortColumns="True" SelectionMode="Extended" HeadersVisibility="Column" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDetailsVisibilityMode="VisibleWhenSelected" EnableColumnVirtualization="True" EnableRowVirtualization="True" ItemsSource="{Binding Source={StaticResource AppItemData}, Path=., Mode=TwoWay}">



Nov 3, 2009 at 9:14 PM

This is apparently much faster:  dgMain.ItemsSource = Me._data.DefaultView (my DataTable's DefaultView)

That loads almost instantly, compared to having it bind to my CollectionViewSource... which I hopefully won't need for anything like grouping later on...