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

WPF Gridview MUCH slower than WinForms when using child table

1 Answer 176 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 24 Feb 2011, 07:19 PM
Hello,

Our application uses gridviews to display hierarchical data using two separate data tables that share a key for lookup purposes.

The application previously used WinControls RadGridView and joined the two tables using a GridViewRelation. 

                this.Grid.BeginUpdate();
                this.Grid.MasterTemplate.Reset();
                Grid.DataSource = datatables[0];
                if (AddDetails)
                {
                    GridViewTemplate template = new GridViewTemplate();
                    template.DataSource = datatables[1];
                    Grid.Templates.Add(template);

                    GridViewRelation relation = new GridViewRelation(Grid.MasterTemplate);
                    relation.ChildTemplate = template;
                    relation.RelationName = "Details";
                    relation.ParentColumnNames.Add(PC);
                    relation.ChildColumnNames.Add(CC);
                    Grid.Relations.Add(relation);
                }







Once loaded, the lookup was very fast, i.e. I could expand any row to view the child data more or less
instantly.


However when I switched over to the WPF gridview, performance for the same input became
unacceptably slow, for example it takes
approximately 2 seconds every time to expand a row to view the child data.

The WPF xaml looks like so:
   <Grid>
        <telerik:RadGridView x:Name="BugGrid"
                             IsFilteringAllowed="True"
                             IsReadOnly="True"
                             CanUserInsertRows="False"
                             TabIndex="1"
                             AutoGenerateColumns="False"
                             DataLoading="DataLoading"
                             RowHeight="32"
                             MaxColumnWidth="200"
                             EnableRowVirtualization="True"
                             EnableColumnVirtualization="True"
                             DataLoadMode="Asynchronous"
                            
                             >
                             
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding asdfas}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Blah}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding PC}" IsVisible="False"/>
            </telerik:RadGridView.Columns>
            
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition x:Name="Details">
                    <telerik:GridViewTableDefinition.Relation>
                        <telerik:TableRelation>
                            <telerik:TableRelation.FieldNames>
                                <telerik:FieldDescriptorNamePair 
                                    ParentFieldDescriptorName="PC" 
                                    ChildFieldDescriptorName="CC"/>
                            </telerik:TableRelation.FieldNames>
                        </telerik:TableRelation>
                    </telerik:GridViewTableDefinition.Relation>
                </telerik:GridViewTableDefinition>
            </telerik:RadGridView.ChildTableDefinitions>
        </telerik:RadGridView>
    </Grid>

In the code behind I define the properties of the child table in DataLoading
        private void DataLoading(object sender, GridViewDataLoadingEventArgs e)
        {       
            GridViewDataControl dataControl = (GridViewDataControl) sender;
            if (dataControl.ParentRow != null)
            {
                dataControl.AutoGenerateColumns = false;
                dataControl.ShowGroupPanel = false;
                dataControl.IsFilteringAllowed = false;
                dataControl.CanUserFreezeColumns = false;
                dataControl.IsReadOnly = true;
                GridViewDataColumn column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("CC");
                column.IsVisible = false;
                column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("Name");
                dataControl.Columns.Add(column);
                column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("Value");
                dataControl.Columns.Add(column);
            }


I set the data source of the child table definition to the be the data table with the details.

I've been able to determine that it's the looking up of the appropriate child data from
the data table that is the very slow part (e.g. if the details data table is blank,
the rows expand instantly) but why is it SO much slower than the old WinControls grid, which also worked with the same data using a similar Relationship.

More importantly, how can I speed it up?

1 Answer, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 02 Mar 2011, 08:06 AM
Hi Ivan,

Thank you for reporting this problem.
We managed to reproduce it locally but we cannot say what is causing it. We will make a profound investigation and we will notify you as soon as we have progress.
Please, excuse us for the inconvenience caused.
 
Kind regards,
Yordanka
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Ivan
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Share this question
or