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

AlternationCount problem in 2011.1.419

5 Answers 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Serhiy Volhushyn
Top achievements
Rank 1
Serhiy Volhushyn asked on 26 Apr 2011, 03:43 AM
I have a grid with about 20 columns (most of them are combobox and DateTime) and there also a data pager attached to grid.
We set AlternationCount to "2" in order to highlight every 2nd row.
Before everything was ok, but when we switched to build 2011.1.419, grid is showing the new page extremely slow (up to 10 seconds to switch to the new page) when switching pages in data pager.

Here's a simple code to reproduce this:

<UserControl
x:Class="TelerikTest.MainPage"
xmlns:radGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data"
xmlns:radInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<radGrid:RadGridView
Grid.Row="0"
x:Name="RadGridView1"
AutoGenerateColumns="False"
ScrollMode="Deferred"
DataLoadMode="Synchronous"
AlternationCount="2"
>
<radGrid:RadGridView.Columns>
<radGrid:GridViewDataColumn UniqueName="Id" DataMemberBinding="{Binding Path=Id, Mode=TwoWay}" Header="Id" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True" />
<radGrid:GridViewDataColumn UniqueName="Property1" DataMemberBinding="{Binding Path=Property1, Mode=TwoWay}" Header="Property 1" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property1, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property2" DataMemberBinding="{Binding Path=Property2, Mode=TwoWay}" Header="Property 2" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property2, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property3" DataMemberBinding="{Binding Path=Property3, Mode=TwoWay}" Header="Property 3" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property3, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property4" DataMemberBinding="{Binding Path=Property4, Mode=TwoWay}" Header="Property 4" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property4, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property5" DataMemberBinding="{Binding Path=Property5, Mode=TwoWay}" Header="Property 5" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property5, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property6" DataMemberBinding="{Binding Path=Property6, Mode=TwoWay}" Header="Property 6" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property6, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property7" DataMemberBinding="{Binding Path=Property7, Mode=TwoWay}" Header="Property 7" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property7, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property8" DataMemberBinding="{Binding Path=Property8, Mode=TwoWay}" Header="Property 8" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property8, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
<radGrid:GridViewDataColumn UniqueName="Property9" DataMemberBinding="{Binding Path=Property9, Mode=TwoWay}" Header="Property 9" IsReadOnly="False" IsGroupable="True" Width="Auto" IsVisible="True">
<radGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<radInput:RadDatePicker IsEnabled="False" SelectedDate="{Binding Path=Property9, Mode=TwoWay}" />
</DataTemplate>
</radGrid:GridViewDataColumn.CellTemplate>
</radGrid:GridViewDataColumn>
</radGrid:RadGridView.Columns>
</radGrid:RadGridView>
<telerik:RadDataPager PageSize="20" Grid.Row="1" Source="{Binding Items, ElementName=RadGridView1}" IsTotalItemCountFixed="True" DisplayMode="FirstLastPreviousNextNumeric, Text" />
</Grid>
</UserControl>

using System;
using System.Collections.Generic;
using Telerik.Windows.Data;
namespace TelerikTest
{
public partial class MainPage
{
public MainPage()
{
InitializeComponent();
List<MyObject> source = new List<MyObject>();
for (int i = 1; i <= 100; i++ )
{
source.Add(new MyObject
{
Id = Guid.NewGuid(),
Property1 = DateTime.Now,
Property2 = DateTime.Now,
Property3 = DateTime.Now,
Property4 = DateTime.Now,
Property5 = DateTime.Now,
Property6 = DateTime.Now,
Property7 = DateTime.Now,
Property8 = DateTime.Now,
Property9 = DateTime.Now,
});
}
RadGridView1.ItemsSource = new QueryableCollectionView(source);
}
}
public class MyObject : IComparable, IComparable<MyObject>
{
public Guid Id { get; set; }
public DateTime Property1 { get; set; }
public DateTime Property2 { get; set; }
public DateTime Property3 { get; set; }
public DateTime Property4 { get; set; }
public DateTime Property5 { get; set; }
public DateTime Property6 { get; set; }
public DateTime Property7 { get; set; }
public DateTime Property8 { get; set; }
public DateTime Property9 { get; set; }
public override bool Equals(object obj)
{
MyObject obj2 = obj as MyObject;
return (obj2 == null ? false : obj2.Id.Equals(Id));
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
public virtual int CompareTo(object obj)
{
return CompareTo(obj as MyObject);
}
public virtual int CompareTo(MyObject other)
{
return other == null ? 1 : Id.CompareTo(other.Id);
}
}
}

Note: When you set "AlternationCount = 0" everything is ok.

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 26 Apr 2011, 07:50 AM
Hello Serhiy Volhushyn,

Indeed, you are quite right - setting the AlternationCount property of the grid degrades the performance in the presence of much data. We do consider improving the behavior of the RadGridView in such scenarios, but we are still investigating the best approach for handling those cases. For the time being if you want to improve the performance, I would recommend you to set it to "0". 

Kind regards,
Maya
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
Serhiy Volhushyn
Top achievements
Rank 1
answered on 26 Apr 2011, 03:03 PM
I understand, but how come the same code worked fast with old Telerik builds ?
0
Vlad
Telerik team
answered on 26 Apr 2011, 03:15 PM
Hi,

 As far as we know this was never changed. Please send us an application where we can observe faster performance with old version compared to the new one.

Kind regards,
Vlad
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
Serhiy Volhushyn
Top achievements
Rank 1
answered on 26 Apr 2011, 03:41 PM
I have to apologize for misinforming.
In old version of this screen we were using plain text data column and everything was ok.
But when we started to use cell template now rendering is very slow.
It looks like every column with custom cell template (or GridViewComboBoxColumn) adds about 0.3 sec to rendering.
I just wander why it is so slow with 10 columns and 20 rows.
0
Maya
Telerik team
answered on 27 Apr 2011, 12:39 PM
Hello Serhiy Volhushyn,

Generally, the performance will be proportional to the complexity of your grid's settings, especially on the visual elements that will have to be rendered. So, in case you define a lot of CellTemplate-s with heavy controls inside, the performance will be degraded. 
You may take a look at this article for further reference on tips and tricks for improving the behavior of your RadGridView.
 

All the best,
Maya
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
Tags
GridView
Asked by
Serhiy Volhushyn
Top achievements
Rank 1
Answers by
Maya
Telerik team
Serhiy Volhushyn
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or