Optimizing the infragistics wpf datagrid - wpf

I should start out with the disclaimer that I don't have a lot of info into this problem, but I wanted to put a feeler out to see if anyone else had this problem. I started a new job and some folks here are using Infragistics WPF datagrid. The grid was selected because of the visual flexibility, but apparently when there are large amounts of rows in the grid, things begin to perform very poorly. This is possibly due to implementation (not sure, haven't gotten into the code yet) and shouldn't be taken as a negative on the control.
Has anyone else encountered and have any advice I could pass onto the developers? Thanks in advance.
Edit*: I think introducing paging might not be an option. The grid is being used in such a capacity that it is displaying data streamed into it. So the use case is that the end user is monitoring 50-100 rows that are updating with new values intra-second (aka - think running stock tickers instead of flipping through a result set)

I'm having problems with XamDataGrid as well. Although I don't have the right version to attempt this, you might try changing to the high-performance hoverless style, and suppressing events, as described here:
http://blogs.infragistics.com/forums/p/48307/264160.aspx
The rest of the suggestions are a lot more specific and handle particular schemas and use-cases.
Here's a bit more of an overview of Infragistics optimizations:
http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=xamData_Performance_Optimizations_Overview.html

I am using the Xceed DataGrid, but I recently discovered our DataGrid was binding to a View (DataGridCollectionView) and not to a datasource (DataView/DataTable).
This meant we replaced the entire view for each refresh.
By binding to a DataTable, my code now refreshes the DataGrid instantly with a few thousand rows where it use to take 1-2 seconds.
As most grids are similar. please verify how your code is binding to the data that goes into your DataGrid.
I posted some code here in case that helps.

The approach is take is to enable virtualisation - this ensure that only the information on the screen is involved in a repaint. See no problem with 100 rows being continuously updated.

Related

How to let ViewModel trigger View update

I need real time charting (100-200ms updates) of a maximum of 20 series. After some research I settled on syncfusion because I can use the community license and at first sight it seems performant. The only drawback seems to be the sometimes lacky MVVM support.
To get a good realtime performance I found this blog post:
https://www.syncfusion.com/blogs/post/Deliver-high-performance-charts-with-Syncfusions-WPF-chart-control.aspx
I'm especially interested in the 'batch update' section because all 20 series will get updated at the same time, there's no need to rerender the chart 20 times.
An alternative seems to be this: http://help.syncfusion.com/wpf/sfchart/how-to/add-range-of-points-dynamically
I have yet to investigate the differences.
But how can I make this MVVM friendly.
Thanks for your advice!
This requirement can be achieved by accessing the SfChart control from its view(UserControl) which was initialized in the ViewModel class, to have access on SuspendNotification and ResumeNotification methods in SfChart.
Real time updates can be achieved in two ways.
By using auto-scrolling feature, to maintain a fixed amount point in view while real time update and also there is a provision to view old data through scrolling.
By removing the first record from the collection while adding new record at the end.
Demo Samples : Real_Update_Samples

Rendering Thread still slow after Virtualization

At a high level my application is applying about 5 different DataTemplates to a set of ListBoxItems based on their type. These items are laid out on a canvas at specific x, y points. I implemented virtualization on my ListBox and it did not seem to improve the time it takes to complete the rendering thread's processes. It still takes about 8-12 seconds for the UI to be completely loaded and usable by the user. I thought virtualization would help fix this problem but after looking around it looks like it only helps process scrolling large amounts of data. Am I correct in this assumption and does anyone else have any other tips for improving the rendering thread. This is the only problem I am having and then my project is complete. Thanks StackOverflow!
Virtualisation means that only the items you have visible are created, then dynamically destroyed/new items created as you scroll. The alternative is all UI controls are created for all items at once.
It sounds like you have bigger problems with the rest of the app. Do you perform all loading operations on a background thread? Is the UI control tree very complex indeed? Are you displaying 100s or 1,000s of items?
We also had a lot of trouble with performance in WPF. Best way is of course to profile your application. We use ANTS Performance profiler for that, but any .NET profiler will do. We got a huge performance hit, because of the lookup of our XAML Resources. Thats the advice i can give you:
Try to minimize all resources in XAML. But not only that, also try to minimize the amount of XAML files you have. One thing you can try is to defere the loading of complex parts of your DataTemplate. Similiar to what happens when you load a JPEG in a browser, first you will see a pixelated image which will be finer after it finished loading the JPEG. To accomplish that, use a simpler DataTemplate at first and then if this is visible only load the complex template on demand or after a while.
But without more information of your specific problem, we can only guess. This is an old question of mine about a similiar subject, maybe this will help aswell.
Yes, ListBox virtualization is for scrolling. When you have a large number of items in a ListBox, enabling virtualization will make only the visible items (+ a few extra items for scrolling) render, and scrolling the ListBox replaces the data in the rendered items instead of rendering new items.
If you were to post some code, perhaps we could assist you with some performance tweaks

DataGrid scrolling issue fix leads to performance and memory issue

We had issue with the Scrolling of the WPF datagrid. With some analysis found the ScrollViewer.CanContentScroll = true was the culprit. Removing and making it false, the scrolling issue was fixed. BUT yesterday i was analyzing a bug on increase in memory footprint of the WPF application to more than 1.3Gb due to binding a 50k records by mistake. Still it questioned the capabilities of binding even a 10k records. Users dont want pagination. ( its a requirement, cant do much about it!)
On further reader found setting ScrollViewer.CanContentScroll = false makes UI virtualization false. which is making WPF bind all the records and render it on the screen. Which results in exploded memory foot print and performance issues.
For now we thought if the records to be bound are minimal, then set the ScrollViewer.CanContentScroll= false, else set it true.
In short: we are either stuck with scrolling issue or UI virtualization. Is there something which can fix both? Have read about Data Virtualization but do we really need to go that far? am i missing anything out of the box from .net4.0 which could help us?
If you check out the accepted answer of this question... In the 'Choosing between them' section of the answer there is a suggested tip to set the visibility of a custom decorator to hidden when the item is not in view.
But other than that... you're right. You either get smooth scrolling or virtualization... not both.
Additionally, if you group items in your datagrid, check out this answer I posted a while back for a convenient performance improvement.

How to efficiently print huge data inside WPF datagrid?

Datagrid contains more than 200 rows and 15 columns some cell contains graph as well.
Virtualization is enable in datagrid so datagrid doesnt have entire viusal.
The wpf datagrid is great at some things. we haven't had much luck using it with large data sets, its a bit slow and clunky. there are other products such as the xCeed grid which is good for large data sets, however it has its drawbacks as well (its harder to use). We are hoping (hope - one of the tools in this developers arsenal) that they fix this issue in the next release.

Silverlight ItemsControl wih ColumnHeader

How can I add column headers to a Silerlight ItemsControl? I need a fast way to display a List of items that contains also some header info.
This may seem like a simplistic question but why not use the DataGrid in readonly mode?
The downside with data grid is it doesn't use a virtualised ItemsControl so performance may suffer if you are trying to list hundreds of items with many columns.
There's nothing built into the ItemsControl itself, but there's nothing to stop you from making a custom control that has that kind of functionality. It's a little work up front for the ability to reuse it later if it's a piece of UI you need frequently.
Adding too much functionality to it might be overkill though; if you need column sorting or automatic column/header generation, you may find that a DataGrid (as Anthony pointed out already) would be a faster way of getting a lot of functionality for free.

Resources