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

RadGridView performance issue

6 Answers 269 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 07 Oct 2012, 04:03 PM
I've attached a sample project showing me trying to load 5000 rows and 14 columns. The data load happens when you click the button labeled "Push". This seems like it takes far too long to load this amount of data. Here is the XAML and designer code:

XAML:
<Window xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="WpfApplication2.MainWindow"
        Title="MainWindow" Height="350" Width="525" >
    <Grid>
        <StackPanel>
            <Button Content="Push" Click="Button_Click" />
            <telerik:RadGridView  ItemsSource="{Binding Data}" ColumnWidth="100" MaxColumnWidth="100"/>
        </StackPanel>
 
    </Grid>
</Window>

Designer:
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }
 
    public IEnumerable<DataItem> Data {get;set;}
 
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        var data = new List<DataItem>();
        for (int i = 0; i < 5000; i++)
        {
            data.Add(new DataItem());
        }
 
        this.Data = data;
        this.DataContext = this;
    }
}
 
 
 
public class DataItem
{
    public string Col {get;set;}
    public string Col2 { get; set; }
    public string Col3 { get; set; }
    public string Col4 { get; set; }
    public string Col5 { get; set; }
    public string Col6 { get; set; }
    public string Col7 { get; set; }
    public string Col8 { get; set; }
    public string Col9 { get; set; }
    public string Col0 { get; set; }
    public string Col11 { get; set; }
    public string Col12 { get; set; }
    public string Col13 { get; set; }
    public string Col14 { get; set; }
}

I should add that this is using version 2012.2.912.40 of the WPF RadGridView component in a .NET 4.5 WPF application.

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Oct 2012, 05:43 AM
Hi,

 Your grid is measure with infinity for both height and width since it is inside StackPanel. No UI virtualization in this case - you can check our documentation for more info. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Michael
Top achievements
Rank 1
answered on 08 Oct 2012, 02:16 PM
Hi Vlad, thanks for the response. I think I've read the documentation you refer to as well as some other posts about this issue, but I don't think I understand the core of the problem. It seems to be caused by the GridView being placed inside any container which doesn't have a definite height or width, and this causing "infinity". I don't know what this means.

In the case of my application, I need the GridView to be sized based on the size of the outer window. How can I accomplish this without ending up in the performance trap?

Thanks,
Mike
0
Vlad
Telerik team
answered on 09 Oct 2012, 05:56 AM
Hello,

 You should use Grid panel instead StackPanel. You can check this article for more info:
http://msdn.microsoft.com/en-us/library/ms745058.aspx

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Michael
Top achievements
Rank 1
answered on 10 Oct 2012, 02:28 PM
Ok, thanks Vlad. 
0
Rajani
Top achievements
Rank 1
answered on 16 Apr 2013, 07:42 AM
I'm having a similar issue where the grid with just 3 columns and 5000 records is taking couple of minutes to render on the UI. One of the column is set from xaml and the other two are created in code behind ..The radgridview is part inside a user control and defined as below:

<Grid>

<telerik:RadGridView

x:Name="MyRadGridView"

EnableColumnVirtualization="True"

EnableRowVirtualization="True"

ContextMenuOpening="MyRadGridView_ContextMenuOpening"

DataLoaded="MyRadGridView_DataLoaded"

ShowGroupPanel="False"

ItemsSource="{Binding Path=UIMetadataViewModelItemsFiltered}"

>

<telerik:RadGridView.ContextMenu>

<ContextMenu>

 <MenuItem x:Name="ChooseColumnsMenuItem"

Click="GridViewContextMenuItem_Click"

Header="Choose Columns"/>

</ContextMenu>

</telerik:RadGridView.ContextMenu>

<telerik:RadGridView.Columns>

<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Value.Metadata.Attributes[UI Id][0]}" Header="FromXAML"/>

</telerik:RadGridView.Columns>

</telerik:RadGridView>

</Grid>

However this user control is used by other controls.. I read your documentation on Degraded Performance but none of them seem to improve the performance issue  I'm seeing here. As mentioned in some of your forums, I tried creating a simple demo which uses the radgridview and is bound to a simple object with 100,000 records and I do not see any perf issues .. What is wrong with the XAML I have here? Any help would be greatly appreciated.

Thanks.

0
Dimitrina
Telerik team
answered on 18 Apr 2013, 08:02 AM
Hello,

You say that you have checked the instructions from this help article and that you do not experience the problem when you create a simple demo which uses the radgridview. Then, would you please try to recreate the demo similar to your full scenario, when the user control is used by other controls?

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Michael
Top achievements
Rank 1
Rajani
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or