1

In my WPF application, I've got a screen with a tab control. Five of these tabs contain datagrids which need to display a large number of rows (at least 5000). The tables are bound to ObservableCollections of Part objects. Each row displays around 20 points of part data. My problem is that, after the user enters the information they require and generate the data, clicking on a tab causes the application to hang for 30-60 seconds. After this the datagrid finally loads, and with the right virtualization settings, they perform at an acceptable rate (not exactly fast, but not too slow). If I disable virtualization, the program uses up way too much memory, and the loading time isn't really affected.

The most offensive tables consist of about half a dozen template columns. Each template contains controls inside a stackpanel or a grid; basically each row is split into two, like a double-row. This layout is a requirement, and paging is probably not something that the customer is willing to accept.

This is the most important screen in my application and I'm pretty much at a loss about making this work. Is there anything I can do to speed up this process? Perhaps ObservableCollection is the wrong choice?

H.B.
  • 166,899
  • 29
  • 327
  • 400
drowned
  • 530
  • 1
  • 12
  • 31
  • Maybe this will help out? http://stackoverflow.com/questions/697701/wpf-datagrid-performance – Ryan Alford Sep 15 '11 at 21:50
  • As I said, the client will not go for paging. Regarding that link, I have tried all of the code modification suggestions listed in the replies, but I haven't taken a look at the performance toolkit. I'll give that a shot and see if it comes up with anything. – drowned Sep 15 '11 at 21:59
  • The mostly time-consuming task is rendering data into grid, so "paging" is the right approach. Keep in mind that "paging" is rendering only a small chunk of data which user can see, instead of rendering all data at once. Generally, GUI behavior between "paging" vs display all is the same. – Thinhbk Sep 16 '11 at 00:43
  • Just out of curiosity, why won't the client go for paging? – Daniel Szabo Sep 16 '11 at 00:57
  • I'd have to agree with Austin and @ajax81. Paging will probably be your best solution. You said, "paging is PROBABLY not something that the customer is willing to accept". "Probably"? Have you asked? Clients can be understanding if you explain the problems to them. Your problem is that you just have too much data to display at once. – Ryan Alford Sep 16 '11 at 12:09
  • My understanding of what you seem to be talking about is "virtualization", whereas paging is similar, but with the added bonus of having some kind of navigational link to flip between the 'pages' of data (numbers, forward/back, etc). They won't go for this because honestly it kind of sucks. I say probably because I have not asked, as that is not my job... I'm the developer, not the PM or the salesman. This client is not one I would label as understanding. They already have an existing application in place, and they are pretty dead-set on getting an upgrade with similar functionality. – drowned Sep 16 '11 at 13:05

1 Answers1

0

Can you please provide more insights...

  1. Can you check how much time is spent in "generating" the 5 collections of 5000 rows each? (this is what I assume you are saying)

  2. With virtulaization "on" what is the UI loading time "after" we assign the collection to the items source?

  3. What happen if you bind "ItemsSource" to the respective datagrid only when the tabItem is actually Visible \ Selected?

  4. Do you datagrids have default sort member path? Grouping? Filter Paths?

These are a few things I would target to start on the issue.

WPF-it
  • 19,625
  • 8
  • 55
  • 71
  • 1. The collections are already generated when the tabs are clicked. This happens very quickly. 2. 30 - 60 seconds. 3. I don't know, I'll try that now. 4. They have no sorting, no grouping, and no filtering. – drowned Sep 16 '11 at 13:08
  • and an update to #3... I set the itemssource on tab changed, and it still takes about 30 seconds before data starts to show up, and another 20 or 30 before the UI unfreezes completely – drowned Sep 16 '11 at 13:46