Hello,
i've got a problem with a self referencing hierarchy in a gridview.
I've got a List1 that i want to display in a gridview. List 1 has a Property List2 which contains elements of class2 --> (List<class2>).
For this case i used the HierarchyChildTemplate and it works fine.
my problem is that my List2 structure looks like this
id parentId name
1 a
2 1 b
3 1 c
4 2 d
5 4 e
it is an n-level self referencing hierarchy. so i decided to do it similar to this example:
http://www.telerik.com/help/wpf/gridview-self-referencing-grid.html
myproblem is that the first 2 levels (handled by the HierarchyChildTemplate ) are working fine and the 3 to n level Elements (handled by the self referencing hierarchy example) are not displayed in the grid
Code:
myClasshierarchy lools like this:
class1
prop a
prop b
List<class2> <-- 1 level deep
class2
prop 1
prop 2
int ID
int Parent
i've got a problem with a self referencing hierarchy in a gridview.
I've got a List1 that i want to display in a gridview. List 1 has a Property List2 which contains elements of class2 --> (List<class2>).
For this case i used the HierarchyChildTemplate and it works fine.
my problem is that my List2 structure looks like this
id parentId name
1 a
2 1 b
3 1 c
4 2 d
5 4 e
it is an n-level self referencing hierarchy. so i decided to do it similar to this example:
http://www.telerik.com/help/wpf/gridview-self-referencing-grid.html
myproblem is that the first 2 levels (handled by the HierarchyChildTemplate ) are working fine and the 3 to n level Elements (handled by the self referencing hierarchy example) are not displayed in the grid
Code:
<
telerik:RadGridView
x:Name
=
"RadTreeListView1"
AutoGenerateColumns
=
"False"
IsReadOnly
=
"True"
ItemsSource
=
"{Binding List1, Mode=TwoWay}"
CanUserResizeColumns
=
"True"
CanUserFreezeColumns
=
"False"
RowLoaded
=
"RadTreeListView1_RowLoaded"
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
/>
</
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
...some Columndefinitions />
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView.HierarchyChildTemplate
>
<
DataTemplate
>
<
telerik:RadGridView
x:Name
=
"StrukturListe"
IsFilteringAllowed
=
"False"
CanUserSortColumns
=
"False"
CanUserFreezeColumns
=
"False"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding List2,Mode=TwoWay}"
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
>
<
telerik:GridViewTableDefinition.Relation
>
<
telerik:TableRelation
IsSelfReference
=
"True"
>
<
telerik:TableRelation.FieldNames
>
<
telerik:FieldDescriptorNamePair
ParentFieldDescriptorName
=
"Id"
ChildFieldDescriptorName
=
"ParentId"
/>
</
telerik:TableRelation.FieldNames
>
</
telerik:TableRelation
>
</
telerik:GridViewTableDefinition.Relation
>
</
telerik:GridViewTableDefinition
>
</
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
...some Columndefinitions />
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DataTemplate
>
</
telerik:RadGridView.HierarchyChildTemplate
>
</
telerik:RadGridView
>
myClasshierarchy lools like this:
class1
prop a
prop b
List<class2> <-- 1 level deep
class2
prop 1
prop 2
int ID
int Parent