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

Best Practice

4 Answers 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
carlos
Top achievements
Rank 1
carlos asked on 31 Jul 2012, 10:39 AM
We have a grid with around 50 columns and 10.000 rows.
Most of the columns have a template selector that according to the cell value will change the background color, etc.

Even with virtualization enabled, the columns with fixed size, the datatemplates not inline but as resources, the scrolling is very slow...

Any suggestions on how to improve the performance?
Any other way to achieve the same color-based-on-cell-value effect without template selectors?

For example, if we use a list of objects that have a property (string) to which the cell value is being binded and we create another one with the color to bind the cell background to it, will it improve a lot? Is it even possible to specify each cell background on the xaml or only on the cell events?

Thanks

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 01 Aug 2012, 03:28 PM
Hello Carlos,

If the target is to change just the background, you would rather work with CellStyleSelectors instead.
Nevertheless, could you clarify which version of RadControls you are working with ?  

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
carlos
Top achievements
Rank 1
answered on 01 Aug 2012, 03:39 PM
CellStyleSelectors or TemplateSelectors both have the same problem... they will fire on each cell 10000*50 according to the "visible" area.. When the user scrolls, the events are fired on each cell "load", isn't there a more effective/static way of setting the style? Example fire the event the first time but when the user scrolled out and back again, the value for the background remains instead of firing again?

We have two diferent products one still in silverlight 4 and another on silverlight 5.
The versions are:
2011.1.427.1040 / 2012.1.215.1050
0
Maya
Telerik team
answered on 02 Aug 2012, 07:54 AM
Hello Carlos,

Firstly, I would recommend you always to work with our latest official versions - in this case Q2 2012 SP1 so that you can benefit from all of our improvements, new  features and bug fixes. 
As for style and template selectors, they will be executed on each item as the corresponding style/template depends on a particular value. The level of performance degradation may vary depending on their definitions - whether you place a heavy control inside the template for example. Could you provide a bit more information about the way you define your style/template selectors ?

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
carlos
Top achievements
Rank 1
answered on 02 Aug 2012, 03:57 PM

We use this for the cell color:

<Style xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" BasedOn="{x:Null}" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" TargetType="telerik:GridViewCell"><Setter Property="Background"><Setter.Value><SolidColorBrush Color="#BBD91C1C" /></Setter.Value></Setter>
</Style>

And for enable/disable row:

<Style xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" BasedOn="{x:Null}" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" TargetType="telerik:GridViewRow">
<Setter Property="IsEnabled"><Setter.Value>TRUE</Setter.Value></Setter>
<Setter Property="Background"><Setter.Value><SolidColorBrush Color="#E0E0E0" /></Setter.Value></Setter>
</Style>
Tags
GridView
Asked by
carlos
Top achievements
Rank 1
Answers by
Maya
Telerik team
carlos
Top achievements
Rank 1
Share this question
or