I identified performance loss while using Alternating rows.
Based on already existing posts: http://www.telerik.com/forums/alternating-rows-hurts-performance
I implemented my own RowStyle selector:
public class RadGridViewAlternatingRowTemplateSelector : StyleSelector
{
private static int counter = int.MinValue;
public override Style SelectStyle(object item, DependencyObject container)
{
return (counter++ % 2) == 0 ? EvenRowStyle : OddRowStyle;
}
public Style EvenRowStyle { get; set; }
public Style OddRowStyle { get; set; }
}
I tried to keep it as short and simple as possible for a maximum performance.
<template:RadGridViewAlternatingRowTemplateSelector x:Key="AlternativeRowStyleSelector">
<template:RadGridViewAlternatingRowTemplateSelector.EvenRowStyle>
<Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
<Setter Property="Background" Value="{DynamicResource RowBackgroundColor}"/>
</Style>
</template:RadGridViewAlternatingRowTemplateSelector.EvenRowStyle>
<template:RadGridViewAlternatingRowTemplateSelector.OddRowStyle>
<Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
<Setter Property="Background" Value="{DynamicResource SecondRowBackgroundColor}"/>
</Style>
</template:RadGridViewAlternatingRowTemplateSelector.OddRowStyle>
</template:RadGridViewAlternatingRowTemplateSelector>
<Style TargetType="{x:Type telerik:RadGridView}" BasedOn="{StaticResource RadGridViewStyle}">
<Setter Property="RowStyleSelector" Value="{StaticResource AlternativeRowStyleSelector}" />
<Setter Property="GridLinesVisibility" Value="Vertical" />
<Setter Property="ValidatesOnDataErrors" Value="InEditMode" />
<Setter Property="AutoGenerateColumns" Value="False" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="ShowGroupPanel" Value="False" />
<!--<Setter Property="ShowColumnSortIndexes" Value="False" />-->
<!--This is not possible, because no DP!-->
<Setter Property="RowIndicatorVisibility" Value="Collapsed" />
<Setter Property="IsFilteringAllowed" Value="False" />
<Setter Property="CanUserSortColumns" Value="False" />
<Setter Property="CanUserSortGroups" Value="False" />
<Setter Property="CanUserReorderColumns" Value="False" />
<Setter Property="CanUserResizeColumns" Value="False" />
<Setter Property="CanUserResizeRows" Value="False" />
<Setter Property="CanUserFreezeColumns" Value="False" />
<Setter Property="FontSize" Value="{DynamicResource FontSize}" />
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
<Setter Property="EnableColumnVirtualization" Value="False" />
<Setter Property="EnableRowVirtualization" Value="True" />
<Setter Property="GroupRenderMode" Value="Flat" />
</Style>
In addition, I tried using NoXAML assemblies (as you can see at my style definition) to even squeeze more performance out of Telerik controls.
Summary: NoXAML Assemblies, Own Style Selector, GroupRenderMode Flat, other properties in Style, RadGridView in * Grid Row,...
There isn't any single point left I could optimize (refering to this article: http://docs.telerik.com/devtools/wpf/controls/radgridview/troubleshooting/performance)
The performance is pretty damn nice if I use no alternating rows.
But when I use them (and I definitely have to, with or without Telerik) the performance drops to an unacceptable point.
So my question here is: Is there anything I can do to speed things up? Are there any updates on alternating row performance?
Thanks in advance