Hi Support,
I am using Infragistics WPF 14.2 dll. I have an application in which I am loading around 12 lac record in xamdatagrid. I am fetching these records from database to a datatable with the help of BackgroundWorker, but when assigning these records to xamdatagrid i.e.
xamDataGrid1.DataSource = dt.DefaultView;
above single line takes around 1 minute to execute and in between if user clicks in any area of application, application goes in 'Not Responding' state.
looking any solution to resolve 'Not Responding' issue when xamDataGrid is being gettting loaded.
Thanks in advance.
Hello Satyam,
Thank you for your post.
I have been investigating into this issue that you are referring to, and at the moment, I cannot seem to reproduce this issue that you are seeing using the latest version of our Infragistics for WPF 2014.2 suite of controls (specific version 14.2.20142.2283).
As this issue seems to be coming from the assignment of the XamDataGrid's DataSource property, I have created a sample project on my end that creates a DataTable with 1,200,000 rows and 10 columns on load of the main window, and then on Button click, the XamDataGrid is populated with the default view of this DataTable. The view is created in only a couple of seconds on my end.
This leads me to believe that there may be something specific to your application that is causing this. Would it be possible for you to please shed some light on the following?
1. What types of properties are you setting on the XamDataGrid? More specifically, are you setting any of the properties such as RecordContainerGenerationMode, RecordContainerRetentionMode, RecordLoadMode, or CellContainerGenerationMode?
2. What is the containing element that wraps your XamDataGrid? By any chance do you have it placed in a StackPanel or ScrollViewer?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hi Andrew,
First of all, thanks for quick reply. Here I am attaching a sample application. Please run the application (without attaching debugger) and let me know if you are able to replicate 'Not Responding' issue.
Thanks
Thank you for the attached sample project.
After an initial investigation of your sample project, I have not been able to replicate the Not Responding issue that you are referring to, but the sample does appear to hang for awhile on the DataSource setter of the XamDataGrid. I haven't been able to reproduce a minute of this hanging though. When clicking the "Load Data" button, the data is created and loaded into the XamDataGrid in just under 20 seconds on my end, with most of this time coming from the creation of about 1 million records prior to setting the data source. On my end, from the time the XamDataGrid.DataSource setter gets hit to the time the records show up in the grid is about 8 seconds, which is still quite a long time.
I am going to continue to investigate into this sample project to see what may be the issue here, as I'm not seeing any sorts of issues with virtualization of the XamDataGrid at the moment, either. I will update this thread again as soon as I have more information for you on this matter.
I have been doing some further investigation into the sample project that you have provided, and it appears that a great part of the performance hit is coming from the styles that you are applying and the application of the Office2010Blue theme, and another large part is coming from the sheer amount of cells that are being shown in the grid initially because the values in the cells are rather short and so many of the cell presenters need to be created at the start of the application.
Currently, on my monitor, there are 17 columns and 34 rows being shown at the start of your sample application. There will be an inherent performance hit here, as the grid will need to create a CellValuePresenter for the 578 cells that this results in, and it will also need to create the elements for the rows, such as the DataRecordPresenter and the DataRecordCellArea. When you couple this with the application of the Office2010Blue style, along with the custom styles that you are applying, this makes these elements more complex for the WPF rendering engines to create, and you end up with this performance hit that you are seeing.
After pulling out the styles and the Office2010Blue theme setting in the XamDataGrid, and after pre-loading the data in your underlying data source prior to the button click, the operation to show the grid takes about 3 - 5 seconds on my end, with the setter for the XamDataGrid.DataSource property happening in about a half second. With the Office2010Blue theme, this full operation takes about 6 - 8 seconds, as the elements become more complex.
Now, I am fully aware that the removal of your custom styles and the Office2010Blue theme may not be an option for you, or even if it is, you may want to try to squeeze out some extra performance from the XamDataGrid. For this, I would recommend re-templating certain elements of the XamDataGrid to be as simple as they possibly can be. There exists an Infragistics blog where these simplifications are discussed, among other performance optimization options for the XamDataGrid. I would recommend that you take a look at it by following this link to it: http://www.infragistics.com/community/blogs/kiril_matev/archive/2010/10/26/optimizing-xamdatagrid-performance.aspx.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Thank you so much for doing lot of investigation on this. You are right, in my actual application I cannot remove Office2010Blue theme and Custom style. Also surprised when you told that Xamdatagrid datasource setter takes only 8-10 second at your end because at my end it takes almost 45 seconds in my actual application. Further doing some investigation on DemoApplication and my actual application I found that there is much difference in datatype of values that being bind to xamgrid.
So can you please try to load datatable with different type of values (numeric, datetime, float etc) and then bind with xamdatagrid and let me know your findings.
Thanks.
I wouldn't expect the difference in data types to have a huge difference in performance, and after modifying the original sample project to include the same number of columns, but with a higher difference in data types, my expectations were confirmed as there isn't much of a difference. It is also worth noting that the data source setter is likely only taking 8 - 10 seconds with the Office2010Blue theme on my end because I have modified your sample to load the data asynchronously prior to allowing the button that assigns the data source to be clicked. The creation of this rather huge data table is putting quite a strain on the data source setter as well, as it needs to wait for that operation to finish.
The more styling that you apply to your XamDataGrid, the more apt you are to create more performance issues, which is why I had recommended the minimalist styles and the performance optimizations mentioned at the following forum thread: http://www.infragistics.com/community/blogs/kiril_matev/archive/2010/10/26/optimizing-xamdatagrid-performance.aspx. These minimalist styles make the somewhat heavyweight elements that need to be rendered for the XamDataGrid much more lightweight, which will create a much smaller load for WPF to render. As such, this will cause the performance of your application to go much faster.
I have attached the modified version of your sample project that demonstrates the difference in time if the background thread is started at the beginning of your application and the styles are excluded, as I had meant to do that previously, but it appears that the project did not attach correctly.