Best Practice

5 posts, 0 answers
  1. carlos
    carlos avatar
    14 posts
    Member since:
    Sep 2010

    Posted 31 Jul 2012 Link to this post

    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
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Aug 2012 Link to this post

    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.

  3. carlos
    carlos avatar
    14 posts
    Member since:
    Sep 2010

    Posted 01 Aug 2012 Link to this post

    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
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 02 Aug 2012 Link to this post

    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.

  5. carlos
    carlos avatar
    14 posts
    Member since:
    Sep 2010

    Posted 02 Aug 2012 Link to this post

    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>
Back to Top