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

Know low grid performance issue

10 Answers 307 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Romain
Top achievements
Rank 1
Romain asked on 15 Sep 2010, 03:40 PM
Hi,
I currently use the TelerikGridView control in a WPF desktop project and I have some problems with low grid performance, both with loading data, with displaying and with using it.

There are approximatively between 500 and 2.000 records to manage (sometimes up to 10.000 records in one case), and it takes more than 5 minutes to display them.

The grid is contained in an user-control which is itself contained in a scrollviewer (needed).

Here is the code of the grid's user-control:

<telerikGrid:RadGridView x:Class="Ere.Desktop.Modules.Onshore.UserControls.Etape2AGridView"
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    x:Name="radGridView" AutoGenerateColumns="False" ShowGroupPanel="False">
    <telerikGrid:RadGridView.Columns>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique1.CleLibelleType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDTRANSSS1}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique1.LibelleTransfertAmont}" Header="{Localize ONSGRIDTRANSSSSPEAM1}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique1.LibelleTransfertAval}" Header="{Localize ONSGRIDTRANSSSSPEAV1}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique2.CleLibelleType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDTRANSSS2}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique2.LibelleTransfertAmont}" Header="{Localize ONSGRIDTRANSSSSPEAM2}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique2.LibelleTransfertAval}" Header="{Localize ONSGRIDTRANSSSSPEAV2}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique3.CleLibelleType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDTRANSSS3}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique3.LibelleTransfertAmont}" Header="{Localize ONSGRIDTRANSSSSPEAM3}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertSurSiteSpecifique3.LibelleTransfertAval}" Header="{Localize ONSGRIDTRANSSSSPEAV3}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique1.CleLibelleType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDTRANSHS1}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique1.LibelleTransfertAmont}" Header="{Localize ONSGRIDTRANSHSSPEAM1}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique1.LibelleTransfertAval}" Header="{Localize ONSGRIDTRANSHSSPEAV1}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique2.CleLibelleType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDTRANSHS2}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique2.LibelleTransfertAmont}" Header="{Localize ONSGRIDTRANSHSSPEAM2}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique2.LibelleTransfertAval}" Header="{Localize ONSGRIDTRANSHSSPEAV2}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique3.CleLibelleType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDTRANSHS3}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique3.LibelleTransfertAmont}" Header="{Localize ONSGRIDTRANSHSSPEAM3}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding TransfertHorsSiteSpecifique3.LibelleTransfertAval}" Header="{Localize ONSGRIDTRANSHSSPEAV3}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding MilieuCibleSpecifique.IdType, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDMILCIBTYP}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding MilieuCibleSpecifique.LibelleSpecifique}" Header="{Localize ONSGRIDMILCBLSPE}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding CleLibelleModePollution, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDKEYLIBMOD}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding CleModule, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDKEYMODULE}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True"/>
        <telerikGrid:GridViewDynamicHyperlinkColumn DataMemberBinding="{Binding IdBase, Converter={StaticResource MyLocalizeConverter}}" Header="{Localize ONSGRIDSCEBAS}" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" IsGroupable="False" IsFilterable="True" NavigateUrlMemberPaths="FichierAide" NavigateUrlFormatString="{} {0}" />
    </telerikGrid:RadGridView.Columns>
</telerikGrid:RadGridView>

and here is the container code of the grid's user-control:

<Grid>
   <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
   </Grid.ColumnDefinitions>
   <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
   </Grid.RowDefinitions>
   <ctrl:Etape2AGridView Grid.Column="0" Grid.Row="0" x:Name="GridView" ItemsSource="{Binding ScenariosSpecifiques}" DataContext="{Binding CurrentEtape}">
         <i:Interaction.Behaviors>
               <bhv:FilterBehavior Items="{Binding Items}" />
         </i:Interaction.Behaviors>
    </ctrl:Etape2AGridView>
</Grid>


I can't identify the cause of this (very) low performance.

 

Thanks!

10 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 15 Sep 2010, 08:10 PM
I had read recently that if your parent container that houses your RadGridView has a column or row defined with * width it can degrade the performance of it.  As well as not binding to simple types.  It seems like you have both going on in your example.

I am faced with a similar problem currently.  I have updated the column widths and converted all of my object properties to simple types that could be converted.. but the performance is sluggish (specifically in horizontal scrolling).  This didn't seem to change based on having 10k records or 200k records.
0
Vlad
Telerik team
answered on 16 Sep 2010, 08:41 AM
Hi,

 When an UI element is associated with Grid.Row with Height set to Auto, this UI element will be measured with infinity. In case of control (like RadGridView, DataGrid, etc.) with UI virtualization this control will attempt to create all items at once which will cause serious performance problems. 

Sincerely yours,
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
Jason
Top achievements
Rank 1
answered on 16 Sep 2010, 01:49 PM
Wow, that helped a ton.  The performance is perfect now.  The question now is... is there a good way to dynamically size the radgridview so that we aren't wasting space on higher resolution monitors.. and simultaneously not making the grid too large for lower resolution monitors.

Is there some standard on how to do this that I just can't find?
0
Accepted
Vlad
Telerik team
answered on 16 Sep 2010, 02:06 PM
Hi,

 Generally you do not have to do anything special. When Height and Width are not set RadGridView will always resize itself and will take the whole available space. For example if you want to have a grid and toolbar you write following XAML:
...

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <telerik:RadToolBar />
        <telerik:RadGridView ItemsSource="{Binding}" Grid.Row="1" />
...

When the window is resized everything will be resized automatically. 

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
Romain
Top achievements
Rank 1
answered on 20 Sep 2010, 02:44 PM
Thank you very much for your explanation, I will consider it all.
0
LAURENT CHRETIEN
Top achievements
Rank 1
answered on 24 Sep 2010, 04:32 PM
Hello,

We have put the GridView directly inside a stack panel, not into a grid any more. The stack panel itself is inside a TabItem, and we have a ScrollViewer in the parent panel of the TabControl.

<StackPanel>
            <ctrl:Etape2AGridView x:Name="GridView" ItemsSource="{Binding ScenariosSpecifiques}" DataContext="{Binding CurrentEtape}" />
            <Button HorizontalAlignment="Right" Content="{Localize EXPORTEXCEL}" Margin="0,10,20,10" Style="{StaticResource ExportButtonStyle}" Template="{DynamicResource ButtonTemplate}" Height="30" cal:Click.Command="{Binding ExportGridViewCommand}" cal:Click.CommandParameter="{Binding ElementName=GridView}"/>
</
StackPanel>

We still have the same performance issues. It takes about 1 minute to display 900 lines. Weird enough, but turning off filtering and sorting doesn't improve the performances at all (so I guess the filter is done when clicking the button, nothing being prepared before anyway).

Do you have any other idea to improve the performance?
Thank you.
0
Yavor Georgiev
Telerik team
answered on 24 Sep 2010, 04:37 PM
Hello LAURENT CHRETIEN,

 Placing the GridView inside a StackPanel also disables virtualization and incurs a large performance penalty. Why do you need to display 900 items at once?

Kind regards,
Yavor Georgiev
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
LAURENT CHRETIEN
Top achievements
Rank 1
answered on 24 Sep 2010, 04:54 PM
Thanks for your quick answer.

Allright. We are going to try with the code you provided.
How can we split the data? Is there a pagination support or something like this?

Thanks.
0
Yavor Georgiev
Telerik team
answered on 24 Sep 2010, 04:58 PM
Hi LAURENT CHRETIEN,

 You just need to place the RadGridView in a panel such as Grid, Canvas, etc. where its size won't be infinite. Then the RadGridView will only initialize as many items as can fit in its bounding rectangle. Memory usage should go down drastically and performance should improve.

Greetings,
Yavor Georgiev
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
Robert
Top achievements
Rank 1
answered on 02 Jun 2011, 07:47 AM
Hi Yavor Georgiev,
According to performance  of RadGridView inside panel.

I use RadGridView in Grid panel:
<Grid.RowDefinitions>
    <RowDefinition Height="60"/>
    <RowDefinition Height="500"/>
</Grid.RowDefinitions>

The first row is Header and the second one RadGridView.
It works fine according to performance.

How to achieve such effect like having RadGridView fast UI and on the other hand when user change size of the window,
RadGridView also adjust visible amount of rows to fulfill window size.
Thanks in advance.
Robert

Tags
GridView
Asked by
Romain
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Vlad
Telerik team
Romain
Top achievements
Rank 1
LAURENT CHRETIEN
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Robert
Top achievements
Rank 1
Share this question
or