I have an application using xamWebGrid and in the demo configuration it displays just 357 rows. The data are instances of a simple CLR object of 11 properties of value types: datetime (3), enum (2), string (2), int (2), bool (2).
The empty grid is displayed quickly but the time from setting the data source to displaying the data is ~5 seconds. Initially this is quite confusing for users who are unaware they should wait so press F5 to refresh the page. We've put in a "Loading..." message on screen to inform the user but there does not seem to be an event fired by the xamWebGird once the data is displayed. Without such an event we don't know when to remove the loading message.
So two questions: why the delay? There is not a lot of data. Secondly, is there an event that will fire once the display is presented?
Thanks
Bill Seddon
Hi Stephen,
I am not very much sure but I faced slow application response with SilverLight Standard DataGrid too. Is this some problem due to SilverLight architecture limitation like number of controls in Controls Tree or there is some other bug. Can you please elaborate?
If it is related with number of controls in Controls Tree then why it works fine with thousands of rows with 4 or 5 columns (I've seen your application demo with million rows but with paging). I have tested same solution without paging against 100 rows with 25 colunms (2,500 cells) and 10,000 rows with 5 colunms (50,000 cells) and observered that 25 columns have performance issue but 5 columns solution works fine.
Regards,
Imran
Steve, I think you should try and reproduce the problem yourself - it really simple. In silverlight create a class with, say, 9, 10, 11 public properties - make them string and generate a string for each one (say a guid). Create a collection of, say, 300 or 400 instances of the class.
Create a grid in Xaml. I do not use auto generated columns so create template columns for each field in the class and have it bind to the respective field. Now use the collection as the data source and see what happens. I'm sure you will have a large display so make sure there are lots of rows. On my machine (1900x1440 screen) 34 rows can be displayed and the display time is 5 seconds. Resize the browser to show 7 rows and its ~2 seconds.
Also, don't just try it on one of your super dev machines, I'm sure there will be no problem. Hop into the accounts department and try it on one of the standard single core, old machines there and see what happens.
Just to be clear. The control that Alex and croesusdev are refering to is the WPF XamDataGrid, not the SL xamWebGrid.
And you are correct. There will be a direct performance link between the number of cells' that are visible. For everything not in view is virtualized, meaning we don't hook up controls to those cells and rows. And when they do come in view, we recycle the controls that were previously in view, to keep memory low and speed up.
And when you are scrolling with a large grid, there will be some lag in scrolling. We are constantly working on increasing the speed here, however, we are limited to what the SL can actually handle.
One thing you may try is our Deferred scrolling feature, which allows you do display a DataTemplate of the current top row while scrolling, which will give you immediate feedback while scrolling, but lead to no lag between the cursor and scrollbar thumb.
-SteveZ
Alex, I can only point you to the earlier comment in which I observe that the delay appears to be related to the number of rows. I think its the total number of possible cells in the display area but I cannot see a measureable difference when changing the number of columns visible in the display area.
The lag when scrolling also seems to be related to the number of rows visible in the display area.
I imagine the issue is the number of elements in the visual tree. Whe have a map-type application which we now display by generating and displaying a bitmap because performance is not acceptable when trying to use elements. And this type of application exhibits the same kind of problem.
Thanks for the suggestion Steve. For others, the LayoutUpdated event fires many times during startup. But only when the data is finally displayed is the Rows.Count property > 0.
So the trick is to remove the loading indicator (simple text in my case) and remove the event handler only when the grid reports rows exist:
void xamGrid_LayoutUpdated(object sender, EventArgs e) { if (this.xamGrid.Rows.Count() == 0) return; this.xamGrid.LayoutUpdated -= new EventHandler(xamGrid_LayoutUpdated); this.ProgressText.Text = string.Empty; }