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

Multi level Child Table Definition

2 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
WVA WVA
Top achievements
Rank 1
WVA WVA asked on 30 Nov 2009, 05:59 AM
Hi all,
I want to display a multi level child table in grid view. In C# code I have something similar to:

            GridViewTableDefinition universitiesnew GridViewTableDefinition(); 
            universities.Relation = new Telerik.Windows.Data.PropertyRelation("Universities"); 
            RadGridView1.ChildTableDefinitions.Add(universities); 
 
            GridViewTableDefinition careersnew GridViewTableDefinition(); 
            careers.Relation = new Telerik.Windows.Data.PropertyRelation("Careers"); 
            universities.ChildTableDefinitions.Add(careers); 
 
 
            GridViewTableDefinition subjectsnew GridViewTableDefinition(); 
            subjects.Relation = new Telerik.Windows.Data.PropertyRelation("Subjects"); 
            careers.ChildTableDefinitions.Add(subjects); 

And in xaml file:

        <Controls:RadGridView.ChildTableDefinitions> 
                <Controls:GridViewTableDefinition AutoGenerateFieldDescriptors="True"
                    <Controls:GridViewTableDefinition.Relation> 
                        <data:PropertyRelation ParentPropertyName="Univesities" /> 
                    </Controls:GridViewTableDefinition.Relation> 
                </Controls:GridViewTableDefinition> 
                 
                <Controls:GridViewTableDefinition AutoGenerateFieldDescriptors="True"
                    <Controls:GridViewTableDefinition.Relation> 
                        <data:PropertyRelation ParentPropertyName="Careers" /> 
                    </Controls:GridViewTableDefinition.Relation> 
                </Controls:GridViewTableDefinition> 
                 
                <Controls:GridViewTableDefinition AutoGenerateFieldDescriptors="True"
                    <Controls:GridViewTableDefinition.Relation> 
                        <data:PropertyRelation ParentPropertyName="Subjects" /> 
                    </Controls:GridViewTableDefinition.Relation> 
                </Controls:GridViewTableDefinition> 
            </Controls:RadGridView.ChildTableDefinitions> 

But this does not do what I want, I think there must be somthing similar to the following xaml to have a multilevel child table definition:
           <Controls:RadGridView.ChildTableDefinitions> 
                <Controls:GridViewTableDefinition AutoGenerateFieldDescriptors="True"
                    <Controls:GridViewTableDefinition.Relation> 
                        <data:PropertyRelation ParentPropertyName="Universities" /> 
 
                        <Controls:GridViewTableDefinition AutoGenerateFieldDescriptors="True"
                            <Controls:GridViewTableDefinition.Relation> 
                                <data:PropertyRelation ParentPropertyName="Careers" /> 
 
                                <Controls:GridViewTableDefinition AutoGenerateFieldDescriptors="True"
                                    <Controls:GridViewTableDefinition.Relation> 
                                        <data:PropertyRelation ParentPropertyName="Subjects" /> 
                                    </Controls:GridViewTableDefinition.Relation> 
                                </Controls:GridViewTableDefinition> 
 
                            </Controls:GridViewTableDefinition.Relation> 
                        </Controls:GridViewTableDefinition> 
 
                    </Controls:GridViewTableDefinition.Relation> 
                </Controls:GridViewTableDefinition> 
                 
            </Controls:RadGridView.ChildTableDefinitions> 

But of course, this does not work.
Entity classes are similar to:

public class MainClass 
     public ObservableCollection<University> Universities{set;get;} 
 
public class University 
     public ObservableCollection<Career> Careers{set;get;} 
 
public class Career 
     public ObservableCollection<Subject> Subjects{set;get;} 
 
 
public class Subject 

I hope you can help me, thank you in advance.
WVA

2 Answers, 1 is accepted

Sort by
0
Accepted
James
Top achievements
Rank 1
answered on 30 Nov 2009, 07:20 AM
Hello, to see an example of a multi level child grid view see my demo I recently posted.

http://www.telerik.com/community/forums/silverlight/gridview/q3-gridviewheaderrow-template-bug.aspx

The way this works in Q3 is slightly different to Q2, you don't need to bother with defining Child Table Definitions in code anymore, you can define this all in XAML.

Hope this helps,
James.
0
WVA WVA
Top achievements
Rank 1
answered on 01 Dec 2009, 04:21 AM
Hi James,
Thank you very much for you help. This is what I was looking for.

Best regards,
WVA
Tags
GridView
Asked by
WVA WVA
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
WVA WVA
Top achievements
Rank 1
Share this question
or