Hi all,
I recently stumbled into the million rows example (virtual mode) for the WinGrid. That example works perfectly fast and reliable.
I my case I need to pull only 200.000 rows from a LinQ DataSource and display them in the WinGrid. Using the example I quickly succeeded in displaying these rows in just a few seconds.
That is where my problem enters the "game".I need conditional formatting based on the value of a hidden column (0/1) that should result in adding an icon to a cell in each row and in making the row "bold", based on the value (0 = normal + icon1 / 1 = bold + icon2).
My first guess was to add the "checking" to the InitializeRow event of the grid.The result was quite destructive to the performance.My second (more desperate guess) was to check all rows after loading and then do the formatting. That also didn't solve the problem and took far too long.
Would you mind to help me figuring out on how to archive my goal using the WinGrid?Maybe you could post the mentioned example using some conditional formatting as described?That would be great ;)Any ideas are kindly appreciated.
Thanks in advance and best regardsAndy
Hi Andy,
This code is a bit ineffcient memory-wise, because you are creating a new Appearance object for every row, when you could just as easily re-use a single Appearance object. And you are create cells unnecessarily by using the Value property on the cell.
You might want to check out the WinGrid Performance Guide for some tips to save memory.
But none of that should affect performance. I don't see anything here that would cause a performance problem. You are not doing anything that should cause any rows to be loaded that would not already have been loaded by the grid. How many times is the event firing initially? Are you saying it's firing for all the rows in the data source and not just the ones it needs?
Hi Mike,good hearing from you ;)
Here is the code you asked for that ran in the InitializeRowEvent:
// handling processing status in order to format the row the right wayswitch (readStatus){case 0: // unreade.Row.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;e.Row.Cells["readStatusIcon"].Value = (Bitmap) this.imgListEmailInbox.Images[1]; //removedbreak;
}
In the meantime I removed the Bitmap-Stuff that seemed to consume quite a lot of performance and it ran better. Still not sufficient enough to keep it this way, but I need an image there which I am now able to add via the CustomFormatting Tool on DesignTime.
I just started to work with the infragistics tools, so odds are pretty good that I miss something.
Thank you Mike for the time to look into this,have a great dayAndy
InitializeRow is the perfect place to do this. Only the rows that are loaded should be initialized and this fire the event. So if you are experiencing performance problems when using this event, you may be writing your code inefficiently and be forcing the rows to be loaded unnecessarily.
Can you post the code you had in InitializeRow?
Good Morning all,
I changed my expectations a little bit and did some workaround using the Conditional Formatting Dialog. This solved the icon problem, but not the "bold/normal" problem.
If I understood this right it is not possible to set conditions for the complete row based on a certain cell value, is that correct?
It also does not seem to be possible to set the appearence of Cell1 based on the value of Cell2. Please correct me it I am wrong here.
Anyway, it would be interesting to find a solution for the performance loss caused by the InitializeRowEvent if the Grid contains a big number of rows.Maybe anybody has an idea regarding this, any input would be kindly appreciated ;)
have a good day and best regardsAndy