This is a migrated thread and some comments may be shown as answers.

Applying RowStyle impacts scrolling performance

3 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GEB
Top achievements
Rank 1
GEB asked on 19 Apr 2010, 03:19 PM
I'm using the internal build for SL4 RTW.  I went into Blend 4 Beta and created a resource dictionary for the default RowStyle of the RadGridView.  I did not make any changes to the style, other than to create the template/style via Blend.  Now, I have noticed a substantial impact to the scrolling performance of the grid.  Becuase I didn;t modify the style, its appearance is exactly the same, but there is a noticeable slowness now in scrolling.

How to reproduce:
1. Create a SL4 project with a simple RadGridView (I populated it with about 150 rows of data).
2. Open the project in Blend 4 Beta, and editthe template for RowStyle.  Save this template unchanged.
3. Rebuild the project and run.  When vertically scrolling the rows, you will notice that the performance is much slower.

3 Answers, 1 is accepted

Sort by
0
GEB
Top achievements
Rank 1
answered on 19 Apr 2010, 03:34 PM
An additional note.  The slowness only seems to occur if the grid has alternating row styles (AlternationCount="2").
0
Rossen Hristov
Telerik team
answered on 19 Apr 2010, 04:09 PM
Hi GEB,

This happens when there is Style/AlternateRowStyle defined, there is alternation and the vertical virtualization is turned on. When scrolling up and down, each container (GridViewRow) is reused to host multiple data items. Some of them are alternating and some of them are not. That is why each time the container hosts an item different from the one before that in terms of alternation, its Style is reapplied. And that is very costly in Silverlight. Now you have three options to avoid this:

- Turn virtualization off.
- In case you want to changed only the background of alternating rows, you can use the AlternateRowBackground property -- this is a lightweight option instead of redefining a whole style.
- You can attach to the RowLoaded event of the grid and do something on the row, i. e. paint it or something. The in RowUnloaded return the row to its default state, i.e. if you have painted it red on RowLoaded, then unpaint it on RowUnloaded.
- Turn alternation off (which I guess is not an option in your case).

The bottom-line is that constantly setting the Style property of a recycled and reused container (GridViewRow) is an expensive operation (Silverlight) and there is not much we can do to change this fact.

The main question here is: What do you need to do in the RowStyle of the grid? Depending on the answer you should choose one of the options above.

I hope this helps.

Sincerely yours,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
GEB
Top achievements
Rank 1
answered on 19 Apr 2010, 05:09 PM
Thank you for the very fast response.  I set EnableRowVirtualization="False", and it solved the problem.  In my particular case, I don;t require virtualization.

Tags
GridView
Asked by
GEB
Top achievements
Rank 1
Answers by
GEB
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or